Skip to main content

RedactedMap

Struct RedactedMap 

Source
pub struct RedactedMap<'a, M: ?Sized, K: ?Sized = String, V: ?Sized = String> { /* private fields */ }
Expand description

A lazy map view that classifies values by their runtime keys.

§Type Parameters

  • 'a - Lifetime of the borrowed map.
  • M - Borrowed map-like container type.
  • K - Runtime key type used for field classification.
  • V - Value type formatted or serialized through redaction.

Implementations§

Source§

impl<'a, M: ?Sized, K: ?Sized, V: ?Sized> RedactedMap<'a, M, K, V>

Source

pub const fn new(map: &'a M, policy: RedactionPolicy) -> Self

Creates a lazy map view without traversing or cloning the map.

§Parameters
  • map - String-valued map-like container to borrow.
  • policy - Complete policy snapshot owned by the view.
§Returns

A lazy borrowed map view.

Source

pub const fn with_output_limit( self, limit: LogOutputLimit, ) -> BoundedRedactedDisplay<Self>

Converts this view into a byte-bounded, log-safe display adapter.

§Parameters
  • limit - Maximum rendered bytes including any truncation marker.
§Returns

A bounded formatting adapter that owns this redacted map view.

Source

pub fn with_policy_output_limit(self) -> BoundedRedactedDisplay<Self>

Converts this view into a byte-bounded display adapter using its policy.

§Returns

A formatting adapter bounded by this view’s diagnostic output budget.

Trait Implementations§

Source§

impl<M: RedactMapValue<K, V> + ?Sized, K: ?Sized, V: ?Sized> Debug for RedactedMap<'_, M, K, V>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the map by classifying every value with its corresponding key.

§Parameters
  • formatter - Destination debug formatter.
§Returns

The formatter result for the complete map.

§Errors

Returns fmt::Error when the destination rejects an entry or the completed map.

Source§

impl<M: RedactMapValue<K, V> + ?Sized, K: ?Sized, V: ?Sized> Display for RedactedMap<'_, M, K, V>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats bounded compact redacted debug output and escapes it for plain-text logs.

§Parameters
  • formatter - Destination formatting context.
§Returns

The formatter result for the escaped redacted representation.

§Errors

Returns fmt::Error when the destination rejects the complete log-safe representation.

Source§

impl<M: RedactMapSerialize<K, V> + ?Sized, K: ?Sized, V: ?Sized> Serialize for RedactedMap<'_, M, K, V>

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serializes values after classifying each one by its runtime key.

§Type Parameters
  • S - Destination Serde serializer type.
§Parameters
  • serializer - Destination Serde serializer.
§Returns

The serializer’s successful map output.

§Errors

Returns the first entry or destination serialization error unchanged.

Auto Trait Implementations§

§

impl<'a, M, K, V> Freeze for RedactedMap<'a, M, K, V>
where M: ?Sized, K: ?Sized, V: ?Sized,

§

impl<'a, M, K, V> RefUnwindSafe for RedactedMap<'a, M, K, V>
where M: RefUnwindSafe + ?Sized, K: ?Sized, V: ?Sized,

§

impl<'a, M, K, V> Send for RedactedMap<'a, M, K, V>
where M: Sync + ?Sized, K: ?Sized, V: ?Sized,

§

impl<'a, M, K, V> Sync for RedactedMap<'a, M, K, V>
where M: Sync + ?Sized, K: ?Sized, V: ?Sized,

§

impl<'a, M, K, V> Unpin for RedactedMap<'a, M, K, V>
where M: ?Sized, K: ?Sized, V: ?Sized,

§

impl<'a, M, K, V> UnsafeUnpin for RedactedMap<'a, M, K, V>
where M: ?Sized, K: ?Sized, V: ?Sized,

§

impl<'a, M, K, V> UnwindSafe for RedactedMap<'a, M, K, V>
where M: RefUnwindSafe + ?Sized, K: ?Sized, V: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.