microtype 0.7.6

A crate to simplify the creation of microtypes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
microtype::microtype! {
    #[secret]
    String {
        Password
    }
}

fn main() {
    use microtype::secrecy::ExposeSecret;
    use microtype::SecretMicrotype;
    let password = Password::new("string".into());
    assert_eq!(password.expose_secret(), "string");

    // secret microtype is clone and debug by default
    let _ = password.clone();
    let password = format!("{:?}", password);
    assert!(password.contains("REDACTED"))
}