Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 456 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 456 Bytes

Custom Debug Macro

Example Usage:

use debug_derive::CustomDebug;

#[derive(CustomDebug)]
pub struct Field {
    name: &'static str,
    #[debug = "0b{:08b}"]
    bitmask: u8,
}

fn main() {
    let f = Field {
        name: "F",
        bitmask: 0b00011100,
    };
    
    let debug = format!("{:?}", f);
    let expected = r#"Field { name: "F", bitmask: 0b00011100 }"#;

    assert_eq!(debug, expected);

    println!("{:?}", debug);
}