Skip to main content

RedactedKeyedValue

Struct RedactedKeyedValue 

Source
pub struct RedactedKeyedValue<'value, 'policy, T: ?Sized> { /* private fields */ }
Expand description

A borrowed value rendered according to a separate field key.

The key is used only to select a policy rule. The view itself renders or serializes the value, and borrows an immutable policy snapshot.

§Type Parameters

  • 'value - Lifetime of the borrowed key and value.
  • 'policy - Lifetime of the borrowed policy snapshot.
  • T - Value type rendered or serialized through redaction.

Implementations§

Source§

impl<'value, 'policy, T: ?Sized> RedactedKeyedValue<'value, 'policy, T>

Source

pub const fn new( key: &'value str, value: &'value T, policy: &'policy RedactionPolicy, ) -> Self

Creates a keyed view from borrowed inputs and a borrowed policy snapshot.

§Parameters
  • key - Field name used only for policy classification.
  • value - Value to render or serialize lazily.
  • policy - Complete policy snapshot borrowed by this view.
§Returns

A view that never modifies the original value.

Source

pub const fn key(&self) -> &'value str

Returns the external field key used by this view.

§Returns

The unchanged policy lookup key.

Trait Implementations§

Source§

impl<T: Redact + RedactValue + ?Sized> Debug for RedactedKeyedValue<'_, '_, T>

Source§

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

Formats the value through its selected field classification.

§Parameters
  • formatter - Destination formatter whose flags are preserved.
§Returns

The complete redacted debug result.

§Errors

Returns fmt::Error when the destination formatter cannot accept the complete representation.

Source§

impl<T: Redact + RedactValue + ?Sized> Display for RedactedKeyedValue<'_, '_, T>

Source§

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

Formats the selected redacted representation for a plain-text log.

§Parameters
  • formatter - Destination plain-text log boundary.
§Returns

The complete escaped redacted representation.

§Errors

Returns fmt::Error when the destination formatter cannot accept the complete escaped representation.

Source§

impl<T: RedactValue + RedactSerialize + ?Sized> Serialize for RedactedKeyedValue<'_, '_, T>

Available on crate feature serde only.
Source§

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

Serializes the value through its selected field classification.

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

The serializer’s successful redacted output.

§Errors

Returns the destination serializer’s error unchanged.

Auto Trait Implementations§

§

impl<'value, 'policy, T> Freeze for RedactedKeyedValue<'value, 'policy, T>
where T: ?Sized,

§

impl<'value, 'policy, T> RefUnwindSafe for RedactedKeyedValue<'value, 'policy, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'value, 'policy, T> Send for RedactedKeyedValue<'value, 'policy, T>
where T: Sync + ?Sized,

§

impl<'value, 'policy, T> Sync for RedactedKeyedValue<'value, 'policy, T>
where T: Sync + ?Sized,

§

impl<'value, 'policy, T> Unpin for RedactedKeyedValue<'value, 'policy, T>
where T: ?Sized,

§

impl<'value, 'policy, T> UnsafeUnpin for RedactedKeyedValue<'value, 'policy, T>
where T: ?Sized,

§

impl<'value, 'policy, T> UnwindSafe for RedactedKeyedValue<'value, 'policy, T>
where T: RefUnwindSafe + ?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.