Debug

The Debug trait tells Rust how to format the data value for debugging output. One place this is used is if we use {:?} instead of {} as the substitution marker for the data value in println! or print!.

Since the debugging representation of a data value should be pretty close to the way it would be represented in the source code, Rust is able to derive it for us automatically.

Deriving Debug looks like this:

#[derive(Debug)]
pub enum DebugExample {
Good,
Bad,
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.14.98