Skip to main content

NotSensitiveDisplay

Derive Macro NotSensitiveDisplay 

Source
#[derive(NotSensitiveDisplay)]
Expand description

Derives redactable::RedactableDisplay for types with no sensitive data.

This is the display counterpart to NotSensitive. Use it when you have a type with no sensitive data that needs logging integration (e.g., for use with slog).

Unlike SensitiveDisplay, this derive does not require a display template. Instead, it delegates directly to the type’s existing Display implementation.

§Required Bounds

The type must implement Display. This is required because RedactableDisplay delegates to Display::fmt.

§Generated Impls

  • RedactableContainer: no-op passthrough (allows use inside Sensitive containers)
  • RedactableDisplay: delegates to Display::fmt
  • slog::Value and SlogRedacted (behind cfg(feature = "slog")): uses RedactableDisplay output
  • TracingRedacted (behind cfg(feature = "tracing")): marker trait

§Debug

NotSensitiveDisplay does not generate a Debug impl — there’s nothing to redact. Use #[derive(Debug)] alongside NotSensitiveDisplay when needed:

§Rejected Attributes

#[sensitive] and #[not_sensitive] attributes are rejected on both the container and its fields — the former is wrong (the type is explicitly non-sensitive), the latter is redundant (the entire type is already non-sensitive).

§Example

use redactable::NotSensitiveDisplay;

#[derive(Clone, NotSensitiveDisplay)]
#[display(fmt = "RetryDecision")]  // Or use displaydoc/thiserror for Display impl
enum RetryDecision {
    Retry,
    Abort,
}