I have several large structs that have a small number of fields for which #[derive(Debug)]
can't easily work, and wouldn't make much sense anyway. I could write my own impl Debug
for each such struct, but that would be a lot of work, especially as I'm often adding new fields. Is there a way to annotate certain fields in a struct so that #[derive(Debug)]
will generate an impl that will print out the field's name but elide its value?
My alternative is to wrap the types of those fields in something that impls Debug to print an elided value, and also impls Deref/DerefMut to transparently act like the original type. I think that will work, but this sounds like a wheel that's already been invented, perhaps?