pub trait DisplayRedacted {
// Required methods
fn fmt_redacted(&self, f: &mut Formatter<'_>) -> Result;
fn fmt_unredacted(&self, f: &mut Formatter<'_>) -> Result;
// Provided methods
fn display_redacted(&self) -> impl Display + '_ { ... }
fn display_unredacted(&self) -> impl Display + '_ { ... }
}Expand description
A type that can be displayed in a redacted or un-redacted form, but which forces the caller to choose.
See Redactable for more discussion on redaction.
Unlike Redactable, this type is “inherently sensitive”:
Types implementing DisplayRedacted should not typically implement
Display.
For external types that implement Display,
or for types which are usually not sensitive,
Redacted is likely a better choice.
Required Methods§
Sourcefn fmt_redacted(&self, f: &mut Formatter<'_>) -> Result
fn fmt_redacted(&self, f: &mut Formatter<'_>) -> Result
As Display::fmt, but write this object
in its redacted form.
Sourcefn fmt_unredacted(&self, f: &mut Formatter<'_>) -> Result
fn fmt_unredacted(&self, f: &mut Formatter<'_>) -> Result
As Display::fmt, but write this object
in its un-redacted form.
Provided Methods§
Sourcefn display_redacted(&self) -> impl Display + '_
fn display_redacted(&self) -> impl Display + '_
Return a pointer wrapping this object that can be Displayed in redacted form if safe-logging is enabled.
(If safe-logging is not enabled, it will de displayed in its unredacted form.)
Sourcefn display_unredacted(&self) -> impl Display + '_
fn display_unredacted(&self) -> impl Display + '_
Return a pointer wrapping this object that can be Displayed in unredacted form.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".