Skip to main content

NotSensitive

Derive Macro NotSensitive 

Source
#[derive(NotSensitive)]
{
    // Attributes available to this derive:
    #[not_sensitive]
}
Expand description

Derives a no-op redactable::RedactableContainer implementation, along with slog::Value / SlogRedacted and TracingRedacted.

This is useful for types that are known to be non-sensitive but still need to satisfy RedactableContainer / Redactable bounds. Because the type has no sensitive data, logging integration works without wrappers.

§Generated Impls

  • RedactableContainer: no-op passthrough (the type has no sensitive data)
  • slog::Value and SlogRedacted (behind cfg(feature = "slog")): emits the Debug representation as a string. Requires the type to implement Debug (use #[derive(Debug)]).
  • TracingRedacted (behind cfg(feature = "tracing")): marker trait

§Debug

NotSensitive does not generate a Debug impl. Unlike Sensitive (which generates Debug to redact sensitive fields), NotSensitive types have nothing to redact — standard #[derive(Debug)] is the right tool. Add it alongside NotSensitive:

#[derive(Clone, Debug, NotSensitive)]
struct PublicData { ... }

Unions are rejected at compile time.