linebender/piet

[feature request]: bound types on `Debug`

richard-uk1 opened this issue · 1 comments

It would occasionally help debugging very much if RenderContext, Text, TextLayoutBuilder, TextLayout, Image etc. were all bounded by Debug, so when e.g. you're retaining them in a struct you can just derive(Debug).

cmyr commented

Yes this is reasonable request.

Do we expect these impls to be useful?

In any case I see two options: we can add these bounds to the trait (trait Text: Debug) or we can make this an informal contract for things reexported by piet-common, and just have a test in piet-common that checks that Debug is impl'd for these types, like:

fn check_debug<T: Debug>() {};

#[test]
fn ensure_debug() {
    check_debug::<PietText>();
   // etc
}

I have some sort of emotional preference for not having this be a bound on the traits, but I'm not sure where that comes from honestly.