Expand description
§Qubit Redact
Borrowed domain redaction for logs, errors, and structured diagnostics.
Choose Redactor::redact_view for lazy formatting/serialization, or
Redactor::redact_text for finalized text and a completeness summary.
With json, Redactor::to_json serializes a domain view directly.
use qubit_redact::Redactor;
let output = Redactor::standard().redact_field("password", "raw-secret");
assert_eq!(output.text().as_str(), "<redacted>");§Domain and serialization capabilities
#[derive(Redact)] implements Redact. #[redact(debug)] and
#[redact(display)] opt into ordinary diagnostic formatting. With serde,
the derive also generates structured redaction for views. Adding
#[redact(serde)] makes the source’s ordinary Serialize implementation
redacted as well.
RedactScalar supports one-field scalar newtypes without implementing
business Debug, Display, or Serialize. Explicit level annotations at the
use site determine sensitivity. Third-party values can select
#[redact(level = "secret", display)].
§Policies and execution
Views own immutable policy snapshots but borrow live source values. Every
use starts a new execution and budget. RedactedText is finalized and
does not run redaction again. DiagnosticRedactionBatch shares a budget
across related values; RedactedTextComposer builds one ordered message.
Unmarked fields remain ordinary output. Explicit derive levels are final; runtime field rules, floors, and strict mode do not override them. Disabled policy deliberately restores source values. Generated ordinary formatting and serialization read the application default at each call; explicit views and redactors retain their captured policies.
Text completion describes diagnostic completeness under the selected
policy. Ordinary logging can use output.text() directly; audit callers
can inspect summaries or reject incomplete text. This library does not
erase source memory or protect output that bypasses its entry points.
See the user guide for complete setup, type/attribute tables, format integrations, and budgets.
Modules§
- formats
- Protocol and process-format adapters layered over the common runtime.
Structs§
- Allow
Rule - A borrowed canonical field name and the breadth of its allow rule.
- Debug
Display - Presents a borrowed
fmt::Debugvalue throughfmt::Display. - Diagnostic
Redaction Batch - Accumulates independently resolvable redaction items under one budget.
- Diagnostic
Redaction Handle - Opaque reference to one unpublished item in a
crate::DiagnosticRedactionBatch. - Diagnostic
Redaction Output - Presents batch items for diagnostics without exposing resolution errors.
- Fields
Builder - Mutable view over the base field policy.
- Http
Context Builder View - Mutable view over one HTTP field context.
- Http
Policy Builder View - Mutable view over all HTTP context differences.
- Masking
Policy - Mask policies assigned to all supported sensitivity levels.
- Masking
Policy Builder - Mutable construction state for a
MaskingPolicy. - Redacted
Text - Final UTF-8 text produced by a redaction operation under its selected policy.
- Redacted
Text Composer - Builds one ordered, redacted text value through consuming chained calls.
- Redacted
View - A lazy view of a source value under one fixed redaction policy.
- Redaction
Floor - Immutable minimum field-protection rules.
- Redaction
Floor Builder - Builder for a
RedactionFloor. - Redaction
Inspection - Highest sensitivity found by one complete, bounded inspection.
- Redaction
Inspection Error - An inconclusive redaction inspection.
- Redaction
Limits - Structural and JSON limits for one redaction operation.
- Redaction
Limits Builder - Mutable construction state for
RedactionLimits. - Redaction
Policy - Immutable field classification, masking, format, and resource policy.
- Redaction
Policy Builder - Mutable construction state for an immutable
RedactionPolicy. - Redaction
Reasons - Compact set of summary reasons.
- Redaction
Rules - Immutable, cheap-to-clone field classification snapshot.
- Redaction
Summary - Machine-readable summary of one redaction operation.
- Redaction
Text Output - Published policy-transformed text and completion metadata from one operation.
- Redaction
Usage - Measured resource use for one redaction transaction.
- Redaction
Writer - Restricted writer for one redaction operation.
- Redactor
- Applies one immutable policy snapshot to supported diagnostic values.
- Sensitive
Field Rule - A borrowed canonical field name and its configured sensitivity.
- UriPolicy
Builder View - Mutable view over URI-specific behavior.
Enums§
- Field
Classification - Explains why a field is sensitive, allowed, or unknown to a policy.
- Field
Match Kind - Identifies the candidate that matched a configured field rule.
- Field
Name Matching - Controls which canonical field-name candidates may match policy rules.
- Mask
Policy - Strategy used to mask one sensitive field value.
- Policy
Error - Error returned when a redaction policy contains an invalid rule.
- Policy
Location - Policy construction context where a validation error occurred.
- Redaction
Completion - Describes whether a redaction operation produced all required safe output.
- Redaction
Reason - Reason why a policy-transformed representation is degraded.
- Sensitive
Field Preset - Predefined groups of sensitive field names.
- Sensitivity
- Sensitivity assigned to a field or explicit value.
- Unkeyed
Json Value Policy - Controls whether unkeyed JSON scalar values are redacted or preserved.
- Unknown
Field Policy - Determines how a policy handles a field with no matching rule.
Traits§
- Redact
- Formats a domain object through the shared immutable redaction writer.
- Redact
Scalar - A single scalar representation usable with an explicit redaction level.
- Redact
Serialize - Legacy structured-redaction hook for manually implemented container adapters. Derived domain values use the projection capability instead.
Derive Macros§
- Redact
- Derives the borrowing
qubit_redact::Redactimplementation. - Redact
Scalar - Derives a scalar leaf capability for a one-field value object.