4 releases

0.1.3 Nov 20, 2023
0.1.2 Nov 20, 2023
0.1.1 Nov 20, 2023
0.1.0 Nov 20, 2023

#307 in Value formatting

Download history 72/week @ 2024-01-05 167/week @ 2024-01-12 133/week @ 2024-01-19 122/week @ 2024-01-26 204/week @ 2024-02-02 256/week @ 2024-02-09 314/week @ 2024-02-16 254/week @ 2024-02-23 421/week @ 2024-03-01 284/week @ 2024-03-08 177/week @ 2024-03-15 39/week @ 2024-03-22 150/week @ 2024-03-29 207/week @ 2024-04-05

593 downloads per month

Apache-2.0

6KB
115 lines

hide (from debug)

crates.io docs.rs

Hide secrets from logs.

Seriously?

You might ask: "A crate, for a simple feature like this?". Yes, maybe this type will be shared between crates. Compared to multiple different types in different crates.

Add to your project

hide = "0.1

Usage

use hide::Hide;

#[derive(Debug)]
pub struct MyStruct {
    username: String,
    password: Hide<String>,
}

fn example1() {
    let data = MyStruct {
        username: "user".to_string(),
        password: "password".to_string().into(),
    };
    println!("{data:#?}");
}

Will give you:

MyStruct {
    username: "user",
    password: ***,
}

lib.rs:

Hide credentials from debug output

Example

use hide::Hide;

#[derive(Debug)]
pub struct MyStruct {
    username: String,
    password: Hide<String>,
}

fn example1() {
    let data = MyStruct {
        username: "user".to_string(),
        password: "password".to_string().into(),
    };
    println!("{data:#?}");
}

No runtime deps