Skip to main content

Redact

Trait Redact 

Source
pub trait Redact {
    // Required method
    fn write_redacted(&self, writer: &mut RedactionWriter<'_>);
}
Expand description

Formats a domain object through the shared immutable redaction writer.

Implementations borrow the original value and write only its safe representation. Redaction execution is owned by crate::Redactor.

§Field classification responsibility

An unannotated derive field, or a value written through unmarked or unredacted, is intentionally not redacted. Sensitivity is business-domain knowledge that this framework cannot reliably infer from a Rust type, field name, or current value. Ordinary fields are the large majority, so requiring an explicit “not sensitive” annotation on every one would add noise without adding classification knowledge.

The downstream type therefore owns this trust boundary: it must explicitly use sensitive, nested, map, keyed_value, or json for fields that can contain sensitive data, and repeat that review when the domain model changes. Standard, strict, application-default, and inspection policies deliberately do not override an unmarked-field decision. This is a stable division of responsibility, not an omitted framework safety check.

§Examples

use qubit_redact::{Redact, RedactionWriter, Redactor, Sensitivity};

struct Login {
    password: String,
}

impl Redact for Login {
    fn write_redacted(&self, writer: &mut RedactionWriter<'_>) {
        writer.record("Login", |fields| {
            fields.sensitive_at_least(Sensitivity::Secret, "password", || &self.password);
        });
    }
}

let login = Login { password: "raw-secret".to_owned() };
let output = Redactor::standard().redact_text(&login);
assert!(!output.text().as_str().contains("raw-secret"));
assert_eq!(login.password, "raw-secret");

Required Methods§

Source

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes this value through the invariant-preserving structured writer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact, G: Redact, H: Redact, I: Redact, J: Redact, K: Redact, L: Redact> Redact for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact, G: Redact, H: Redact, I: Redact, J: Redact, K: Redact> Redact for (A, B, C, D, E, F, G, H, I, J, K)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact, G: Redact, H: Redact, I: Redact, J: Redact> Redact for (A, B, C, D, E, F, G, H, I, J)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact, G: Redact, H: Redact, I: Redact> Redact for (A, B, C, D, E, F, G, H, I)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact, G: Redact, H: Redact> Redact for (A, B, C, D, E, F, G, H)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact, G: Redact> Redact for (A, B, C, D, E, F, G)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact, F: Redact> Redact for (A, B, C, D, E, F)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact, E: Redact> Redact for (A, B, C, D, E)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact, D: Redact> Redact for (A, B, C, D)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact, C: Redact> Redact for (A, B, C)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact, B: Redact> Redact for (A, B)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<A: Redact> Redact for (A,)

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Traverses tuple fields through the active nested-value scope.

Source§

impl<T: Redact + ?Sized> Redact for Box<T>

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes the contained domain values while sharing the enclosing structural budget.

Source§

impl<T: Redact, const N: usize> Redact for [T; N]

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes the contained domain values while sharing the enclosing structural budget.

Source§

impl<T: Redact> Redact for Option<T>

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes the contained domain values while sharing the enclosing structural budget.

Source§

impl<T: Redact> Redact for Vec<T>

Source§

fn write_redacted(&self, writer: &mut RedactionWriter<'_>)

Writes the contained domain values while sharing the enclosing structural budget.

Implementors§