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
impl RedactionBatchDiagnostics
Sourcepub fn text(&self, handle: RedactionBatchHandle) -> &RedactedText
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.
Sourcepub const fn summary(&self) -> &RedactionSummary
pub const fn summary(&self) -> &RedactionSummary
Returns the aggregate accounting summary for the underlying batch.