When deriving Debug
, what is the best approach to skip a specific struct field that doesn’t implement Debug
? For example:
#[derive(Debug)]
pub struct MySettings {
pub max_size: usize,
pub max_queue_size: usize,
// this guy doesn't implement Debug
pub my_type: Box<dyn MyType + Send + Sync>
}
I can’t add a crate to the Cargo.toml.
Right now I am providing a blank impl
for that field like this:
impl std::fmt::Debug for (dyn MyType + Send + Sync){
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Ok(())
}
}
4