Skip to main content

RedactionBatchDiagnostics

Struct RedactionBatchDiagnostics 

Source
pub struct RedactionBatchDiagnostics { /* private fields */ }
Expand description

Presents batch items for diagnostics without exposing resolution errors.

A complete item retains its redacted text. An incomplete item, a missing item, or a handle created by another batch resolves to one caller-selected marker. This fail-closed behavior is intended for Debug, Display, logs, and other presentation paths that cannot recover from individual handle failures. The public batch contract deliberately maps every unresolved or incomplete item to the same safe marker.

The marker is escaped once when this object is created, so repeated resolution neither allocates nor permits control characters to forge log structure.

§Examples

use qubit_redact::Redactor;

let mut batch = Redactor::strict().batch();
let handle = batch.redact_field("password", "raw-secret");
let diagnostics = batch.finish_for_diagnostics("<redaction incomplete>");
assert_eq!(diagnostics.text(handle).as_str(), "<redacted>");

Implementations§

Source§

impl RedactionBatchDiagnostics

Source

pub fn text(&self, handle: RedactionBatchHandle) -> &RedactedText

Resolves an item to complete redacted text or the shared marker.

The marker is returned when handle belongs to another batch, names a missing item, or identifies an item whose completion is Truncated or Exhausted. No allocation occurs during resolution.

Source

pub const fn summary(&self) -> &RedactionSummary

Returns the aggregate accounting summary for the underlying batch.

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.