pub struct RedactionTextOutput { /* private fields */ }Expand description
Published policy-transformed text and completion metadata from one operation.
Incomplete output retains the selected policy’s confidentiality guarantees.
Truncated and Exhausted describe incomplete diagnostics; they do not
authorize disclosure of fields protected by that policy. As with
RedactedText, disabled policies and explicitly unredacted operations can
deliberately preserve source content. Callers can reject or replace
incomplete text when their own contract requires completeness.
§Examples
use qubit_redact::RedactionCompletion;
use qubit_redact::Redactor;
let output = Redactor::strict().redact_field("password", "raw-secret");
assert_eq!(output.summary().completion(), RedactionCompletion::Complete);Implementations§
Source§impl RedactionTextOutput
impl RedactionTextOutput
Sourcepub const fn text(&self) -> &RedactedText
pub const fn text(&self) -> &RedactedText
Sourcepub const fn summary(&self) -> &RedactionSummary
pub const fn summary(&self) -> &RedactionSummary
Borrows the execution summary.
§Returns
Borrowed completion, reasons, and resource use for this output.
Sourcepub fn complete_text(&self) -> Result<&RedactedText, &RedactionSummary>
pub fn complete_text(&self) -> Result<&RedactedText, &RedactionSummary>
Borrows the final text when the operation completed without truncation or exhaustion.
§Errors
Returns the execution summary when the safe output was truncated or exhausted. The error reports completeness; it does not imply that the published text is unsafe for diagnostics.
§Returns
Borrowed text only for Complete; otherwise the borrowed execution summary.
Sourcepub fn text_or_marker(&self, marker: &str) -> Cow<'_, str>
pub fn text_or_marker(&self, marker: &str) -> Cow<'_, str>
Borrows the final text or returns an escaped caller-selected marker when the operation was incomplete.
The complete path does not allocate. An incomplete marker is escaped before publication so control characters cannot forge diagnostic log structure. The marker is selected after the transaction and therefore does not consume its resource budget.
§Parameters
marker: Fallback escaped outside the completed operation’s byte budget.
§Returns
Borrowed complete text, or an owned escaped marker for incomplete output.
Sourcepub fn into_complete_text(self) -> Result<RedactedText, RedactionSummary>
pub fn into_complete_text(self) -> Result<RedactedText, RedactionSummary>
Consumes a complete output and returns its final text.
§Errors
Returns the execution summary when the safe output was truncated or exhausted. The error reports completeness; it does not imply that the published text is unsafe for diagnostics.
§Returns
Owned text only for Complete; otherwise the owned execution summary.
Sourcepub fn into_text_or_marker(self, marker: &str) -> RedactedText
pub fn into_text_or_marker(self, marker: &str) -> RedactedText
Consumes the output and returns a caller-selected marker when it is incomplete.
The marker is escaped before becoming RedactedText, so it remains
safe for diagnostic presentation.
§Parameters
marker: Fallback escaped outside the completed operation’s byte budget.
§Returns
Owned complete text, or a wrapper around the escaped fallback marker.
Sourcepub fn into_parts(self) -> (RedactedText, RedactionSummary)
pub fn into_parts(self) -> (RedactedText, RedactionSummary)
Consumes the output and returns both parts.
§Returns
The owned text and summary, in that order, without checking completeness.
Trait Implementations§
Source§impl Clone for RedactionTextOutput
impl Clone for RedactionTextOutput
Source§fn clone(&self) -> RedactionTextOutput
fn clone(&self) -> RedactionTextOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more