pub trait RedactionStrategy<T> {
// Required method
fn display(&self, value: &T, f: &mut Formatter<'_>) -> Result;
// Provided method
fn debug(&self, value: &T, f: &mut Formatter<'_>) -> Result { ... }
}Expand description
A redaction strategy tells apollo-redaction how to redact values for Display and Debug.
The trait is generic over the value being redacted. If you know your redaction strategy is just going to be used for a single type, you can write:
ⓘ
use url::Url;
use apollo_redaction::RedactionStrategy;
#[derive(Default, Clone)]
struct UrlRedactor;
impl RedactionStrategy<Url> for UrlRedactor {
// ...
}§Bounds and deserialization
It’s strongly recommended that all your redaction strategies derive Default and Clone.
Without Default, a redacted value cannot be deserialized with serde, making it
significantly less useful.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".