Skip to main content

RedactedJsonText

Struct RedactedJsonText 

Source
pub struct RedactedJsonText<'text, 'policy> { /* private fields */ }
Expand description

JSON text rendered with recursive object-key redaction.

fmt::Debug and fmt::Display are diagnostic boundaries: they reject text larger than the policy diagnostic input budget before parsing it and apply the policy output budget. Explicit mutation and Serde serialization preserve complete JSON instead.

Implementations§

Source§

impl<'text, 'policy> RedactedJsonText<'text, 'policy>

Source

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

Creates a lazy redacted view over text expected to contain JSON.

§Parameters
  • text - JSON text borrowed without parsing.
  • policy - Immutable policy used to classify parsed object keys.
§Returns

A borrowed fail-closed JSON text view.

Trait Implementations§

Source§

impl Debug for RedactedJsonText<'_, '_>

Source§

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

Formats parsed redacted JSON or an opaque replacement for unsafe text.

Output that exceeds the diagnostic budget ends in the log truncation marker.

§Parameters
  • formatter - Destination formatting context.
§Returns

The formatter result for a safe representation.

§Errors

Returns a formatting error when the destination rejects output.

Source§

impl Display for RedactedJsonText<'_, '_>

Source§

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

Writes compact redacted JSON for a bounded plain-text log boundary.

Complete valid input that fits both diagnostic budgets produces compact valid JSON. Rejected input produces the opaque Secret mask; output that exceeds its budget ends in the log truncation marker and is not JSON.

§Parameters
  • formatter - Destination formatting context.
§Returns

The formatter result for safe log output.

§Errors

Returns a formatting error when the destination rejects output.

Source§

impl Serialize for RedactedJsonText<'_, '_>

Available on crate feature serde only.
Source§

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

Serializes compact redacted JSON while preserving the outer string shape.

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

The destination serializer result.

§Errors

Returns the destination serializer error unchanged.

Auto Trait Implementations§

§

impl<'text, 'policy> Freeze for RedactedJsonText<'text, 'policy>

§

impl<'text, 'policy> RefUnwindSafe for RedactedJsonText<'text, 'policy>

§

impl<'text, 'policy> Send for RedactedJsonText<'text, 'policy>

§

impl<'text, 'policy> Sync for RedactedJsonText<'text, 'policy>

§

impl<'text, 'policy> Unpin for RedactedJsonText<'text, 'policy>

§

impl<'text, 'policy> UnsafeUnpin for RedactedJsonText<'text, 'policy>

§

impl<'text, 'policy> UnwindSafe for RedactedJsonText<'text, 'policy>

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.