#[derive(SensitiveDisplay)]
{
// Attributes available to this derive:
#[sensitive]
#[not_sensitive]
#[error]
}
Expand description
Derives redactable::RedactableWithFormatter using a display template.
This generates a redacted string representation without requiring Clone.
Unannotated fields use RedactableWithFormatter by default (passthrough for scalars,
redacted display for nested SensitiveDisplay types).
§Field Annotations
- (none): Uses
RedactableWithFormatter(requires the field type to implement it) #[sensitive(Policy)]: Apply the policy’s redaction rules#[not_sensitive]: Render raw viaDisplay(use for types withoutRedactableWithFormatter)
The display template is taken from #[error("...")] (thiserror-style) or from
doc comments (displaydoc-style). If neither is present, the derive fails.
Fields are redacted by reference, so field types do not need Clone.
§Generated Impls
RedactableWithFormatter: always generated.Debug: redacted in production, actual values in test/testing builds.slog::Value+SlogRedacted: emits the redacted display string (requiresslogfeature). Skipped when#[sensitive(dual)]is set (Sensitive provides them instead).TracingRedacted: marker trait (requirestracingfeature). Skipped when#[sensitive(dual)]is set.