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>
impl<'a, M: ?Sized, K: ?Sized, V: ?Sized> RedactedMap<'a, M, K, V>
Sourcepub const fn new(map: &'a M, policy: RedactionPolicy) -> Self
pub const fn new(map: &'a M, policy: RedactionPolicy) -> Self
Sourcepub const fn with_output_limit(
self,
limit: LogOutputLimit,
) -> BoundedRedactedDisplay<Self>
pub const fn with_output_limit( self, limit: LogOutputLimit, ) -> BoundedRedactedDisplay<Self>
Sourcepub fn with_policy_output_limit(self) -> BoundedRedactedDisplay<Self>
pub fn with_policy_output_limit(self) -> BoundedRedactedDisplay<Self>
Converts this view into a byte-bounded display adapter using its policy.
§Returns
A display-only 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>
impl<M: RedactMapValue<K, V> + ?Sized, K: ?Sized, V: ?Sized> Debug for RedactedMap<'_, M, K, V>
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
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>
impl<M: RedactMapValue<K, V> + ?Sized, K: ?Sized, V: ?Sized> Display for RedactedMap<'_, M, K, V>
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Formats 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.
impl<M: RedactMapSerialize<K, V> + ?Sized, K: ?Sized, V: ?Sized> Serialize for RedactedMap<'_, M, K, V>
serde only.Source§fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
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.