Skip to main content

RedactedDebug

Trait RedactedDebug 

Source
pub trait RedactedDebug {
    // Required method
    fn fmt(
        &self,
        redactor: &dyn Redactor,
        f: &mut Formatter<'_>,
    ) -> Result<(), Error>;
}
Expand description

Formats the redacted value using the given formatter.

This trait behaves similarly to the standard library’s Debug trait, but it produces a redacted representation of the value based on the provided Redactor.

Types implementing Classified usually implement RedactedDebug as well. Generally speaking, you should just derive an implementation of this trait.

Required Methods§

Source

fn fmt( &self, redactor: &dyn Redactor, f: &mut Formatter<'_>, ) -> Result<(), Error>

Performs the formatting.

§Errors

This function returns Err if, and only if, the provided Formatter returns Err. String redaction is considered an infallible operation; this function only returns a Result because writing to the underlying stream might fail and it must provide a way to propagate the fact that an error has occurred back up the stack.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> RedactedDebug for Sensitive<T>
where T: Debug,