Skip to main content

Redactable

Trait Redactable 

Source
pub trait Redactable {
    // Required methods
    fn fmt_unredacted(&self, f: &mut Formatter<'_>) -> Result;
    fn fmt_redacted(
        &self,
        redactor: &dyn Redactor,
        f: &mut Formatter<'_>,
    ) -> Result;

    // Provided method
    fn fmt_dispatch(&self, f: &mut Formatter<'_>) -> Result { ... }
}
Expand description

Trait implemented by identifier types (such as MAC addresses, BSSIDs, and SSIDs) whose Display and Debug representations support redaction via the global Redactor.

Implementors provide the raw formatting in Redactable::fmt_unredacted and the redacted formatting in Redactable::fmt_redacted; their Display/Debug impls should call Redactable::fmt_dispatch, which picks one based on whether a global redactor has been installed.

Required Methods§

Source

fn fmt_unredacted(&self, f: &mut Formatter<'_>) -> Result

Formats the raw, unredacted value of self.

Used when no global redactor is installed (e.g., on eng builds, in unit tests, and in host tools).

Source

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

Formats self after obscuring it with the provided Redactor.

Implementations should pass their data through Redactor::redact_mac or Redactor::redact_ssid, render the result the same way Redactable::fmt_unredacted renders the raw data, and append REDACTED_MARKER.

Provided Methods§

Source

fn fmt_dispatch(&self, f: &mut Formatter<'_>) -> Result

Formats self through the active global Redactor if one has been installed, or via Redactable::fmt_unredacted otherwise.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§