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")): serializes the value directly as structured JSON without redaction (same format as Sensitive, but skips the redaction step). Requires Serialize on the type.
  • TracingRedacted (behind cfg(feature = "tracing")): marker trait

NotSensitive does not generate a Debug impl — there’s nothing to redact. Use #[derive(Debug)] 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).

Unions are rejected at compile time.