I have a generic function that operates on several different structs. On of these structs looks like this:
struct A {
data: Vec<String>
}
When I try to use dbg!
or println!("{:?}", my_instance)
, I get this error:
`T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
I understand I need to write my own Debug impl, but I don't understand how to do that for vectors. How can I get my struct to just print? I can not figure it out. I've been trying to do something like this:
impl std::fmt::Debug for Datum {
fn fmt(&self) -> String {
format!("{:?}", self)
}
}