Skip to main content

Crate redactable

Crate redactable 

Source
Expand description

Type-directed redaction for structured data.

This crate separates:

  • Policy markers: what kind of sensitive data this is (e.g., Pii, Token, Email).
  • Redaction policies: how that data should be redacted.

The derive macro walks your data and applies the policy at the boundary when you call redact() or Redactable::redact().

What this crate does:

  • defines policy marker types (e.g., Pii, Token, Email)
  • defines redaction policies and the redact entrypoint
  • provides integrations behind feature flags (e.g. slog)

What it does not do:

  • perform I/O or logging
  • validate your policy choices

The Sensitive derive macro lives in redactable-derive and is re-exported from this crate.

Re-exports§

pub use policy::BlockchainAddress;
pub use policy::CreditCard;
pub use policy::Default;
pub use policy::Email;
pub use policy::EmailConfig;
pub use policy::IpAddress;
pub use policy::KeepConfig;
pub use policy::MASK_CHAR;
pub use policy::MaskConfig;
pub use policy::PhoneNumber;
pub use policy::Pii;
pub use policy::REDACTED_PLACEHOLDER;
pub use policy::RedactionPolicy;
pub use policy::TextRedactionPolicy;
pub use policy::Token;

Modules§

policy
Redaction policies: marker types and text transformations.

Structs§

NotSensitiveDebug
Wrapper for explicitly non-sensitive values using Debug.
NotSensitiveDisplay
Wrapper for explicitly non-sensitive values using Display.
NotSensitiveValue
Wrapper for foreign types that should pass through unchanged.
RedactedDisplayRef
Display wrapper that uses RedactableDisplay::fmt_redacted.
RedactedOutputRef
Wrapper for explicitly redacting structured types.
SensitiveValue
Wrapper for leaf values to apply a redaction policy.

Enums§

RedactedOutput
Output produced at a logging boundary.

Traits§

NotSensitiveDebugExt
Extension trait to mark values as explicitly non-sensitive using Debug.
NotSensitiveExt
Extension trait to mark values as explicitly non-sensitive for logging.
Redactable
Public entrypoint for redaction on traversable types.
RedactableDisplay
Formats a redacted string representation without requiring Clone or Serialize.
RedactableLeaf
String-like payloads that can be redacted via policies.
RedactableWithPolicy
A policy-aware leaf that can be redacted without requiring a local newtype.
RedactedOutputExt
Extension trait to obtain a redacted output wrapper.
ToRedactedOutput
Produces a logging-safe output representation.

Functions§

apply_policy
Applies a redaction policy to a policy-applicable value.
apply_policy_ref
Applies a redaction policy to a policy-applicable value by reference.
redact
Redacts a value using policy-bound redaction.

Derive Macros§

NotSensitive
Derives a no-op redactable::RedactableContainer implementation.
Sensitive
Derives redactable::RedactableContainer (and related impls) for structs and enums.
SensitiveDisplay
Derives redactable::RedactableDisplay using a display template.