Skip to main content

NotSensitiveDisplay

Derive Macro NotSensitiveDisplay 

Source
#[derive(NotSensitiveDisplay)]
{
    // Attributes available to this derive:
    #[not_sensitive_display]
}
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.

§Container Attributes

  • #[not_sensitive_display(skip_debug)] - Opt out of Debug impl generation. Use this when you need a custom Debug implementation or the type already derives Debug elsewhere.

§Required Bounds

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

§Generated Impls

  • RedactableDisplay: delegates to Display::fmt
  • Debug: when not building with cfg(any(test, feature = "testing")), Debug formats via Display::fmt. In test/testing builds, it uses standard Debug formatting (requires the type to also implement Debug for test builds).
  • slog::Value (behind cfg(feature = "slog")): uses RedactableDisplay output
  • SlogRedacted (behind cfg(feature = "slog")): marker trait
  • TracingRedacted (behind cfg(feature = "tracing")): marker trait

§Example

use redactable::NotSensitiveDisplay;

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