Skip to main content

Redacted

Struct Redacted 

Source
pub struct Redacted<'a, T: ?Sized> { /* private fields */ }
Expand description

A lazy non-destructive redacted view of a domain object.

The view borrows the original object and owns a cheap clone of the complete policy. Creating it does not inspect, clone, or modify object fields.

§Type Parameters

  • 'a - Lifetime of the borrowed domain object.
  • T - Domain-object type rendered or serialized through redaction.

Implementations§

Source§

impl<'a, T: ?Sized> Redacted<'a, T>

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 display-only adapter that owns this redacted 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 display-only adapter bounded by this view’s diagnostic output budget.

Trait Implementations§

Source§

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

Source§

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

Writes the object’s redacted representation while preserving formatter flags such as alternate pretty formatting.

§Parameters
  • formatter - Destination formatting context whose flags are passed to the object’s redaction hook.
§Returns

The formatter result for the complete redacted representation.

§Errors

Returns fmt::Error when the object cannot write its complete redacted representation.

Source§

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

Source§

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

Writes a compact redacted debug representation escaped for logs.

Redacted debug output is escaped directly into the destination without constructing an intermediate String. This implementation never calls the original object’s Display.

§Parameters
  • formatter - Destination formatting context.
§Returns

The formatter result for the escaped redacted representation.

§Errors

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

Source§

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

Available on crate feature serde only.
Source§

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

Delegates serialization to the derived redaction hook.

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

The derived hook’s successful output.

§Errors

Returns the derived hook’s serialization error unchanged.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Redacted<'a, T>
where T: ?Sized,

§

impl<'a, T> RefUnwindSafe for Redacted<'a, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'a, T> Send for Redacted<'a, T>
where T: Sync + ?Sized,

§

impl<'a, T> Sync for Redacted<'a, T>
where T: Sync + ?Sized,

§

impl<'a, T> Unpin for Redacted<'a, T>
where T: ?Sized,

§

impl<'a, T> UnsafeUnpin for Redacted<'a, T>
where T: ?Sized,

§

impl<'a, T> UnwindSafe for Redacted<'a, 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.