trait

Debug: developer-facing diagnostics

Debug is intended for inspection, not a stable interchange format. A derived implementation can expose every field, so avoid deriving it for sensitive fields without review. Expected stdout (not executed): Job { id: 7 } Common mistake: Parsing Debug output as a long-term file format.

Formal Syntax & Structure

rust syntaxrust
#[derive(Debug)]; {:?}

Working Example

Example Snippetrust
fn main() {    #[derive(Debug)]    struct Job { id: u32 }    let job = Job { id: 7 };    assert_eq!(job.id, 7);    println!("{:?}", job);}
Rust Reference