Skip to main content

RedactionTextOutput

Struct RedactionTextOutput 

Source
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

Source

pub const fn text(&self) -> &RedactedText

Borrows the final text.

§Returns

Borrowed final text, including safe incomplete representations.

Source

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

Borrows the execution summary.

§Returns

Borrowed completion, reasons, and resource use for this output.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> RedactionTextOutput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RedactionTextOutput

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for RedactionTextOutput

Source§

impl PartialEq for RedactionTextOutput

Source§

fn eq(&self, other: &RedactionTextOutput) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RedactionTextOutput

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.