Skip to main content

redacted_debug

Macro redacted_debug 

Source
macro_rules! redacted_debug {
    ($f:ident) => { ... };
    (str $f:ident) => { ... };
}
Expand description

Produces a debug label for an optional value without revealing its contents.

The macro expands to "Some(<redacted>)" when the identifier reports a present value and to "None" otherwise. Its argument must be an identifier supporting an is_some method. The str form is for a secret whose absence is an empty string: it needs is_empty and expands to "<redacted>", or to the quoted empty string a plain Debug would print.