pub enum TextRedactionPolicy {
Full {
placeholder: Cow<'static, str>,
},
Keep(KeepConfig),
Mask(MaskConfig),
}Expand description
A redaction strategy for string-like values.
All strategies operate on Unicode scalar values and return an owned String.
Variants§
Full
Replace the entire value with a fixed placeholder.
Keep(KeepConfig)
Keep configured segments visible while masking everything else.
Mask(MaskConfig)
Mask configured segments while leaving the remainder untouched.
Implementations§
Source§impl TextRedactionPolicy
impl TextRedactionPolicy
Sourcepub fn default_full() -> Self
pub fn default_full() -> Self
Constructs TextRedactionPolicy::Full using REDACTED_PLACEHOLDER.
Sourcepub fn full_with<P>(placeholder: P) -> Self
pub fn full_with<P>(placeholder: P) -> Self
Constructs TextRedactionPolicy::Full using a custom placeholder.
Sourcepub fn keep_with(config: KeepConfig) -> Self
pub fn keep_with(config: KeepConfig) -> Self
Constructs TextRedactionPolicy::Keep from an explicit configuration.
Sourcepub fn keep_first(visible_prefix: usize) -> Self
pub fn keep_first(visible_prefix: usize) -> Self
Keeps only the first visible_prefix scalar values in clear text.
Sourcepub fn keep_last(visible_suffix: usize) -> Self
pub fn keep_last(visible_suffix: usize) -> Self
Keeps only the last visible_suffix scalar values in clear text.
Sourcepub fn mask_with(config: MaskConfig) -> Self
pub fn mask_with(config: MaskConfig) -> Self
Masks segments using the provided configuration.
Sourcepub fn mask_first(mask_prefix: usize) -> Self
pub fn mask_first(mask_prefix: usize) -> Self
Masks the first mask_prefix scalar values.
Sourcepub fn with_mask_char(self, mask_char: char) -> Self
pub fn with_mask_char(self, mask_char: char) -> Self
Overrides the masking character used by keep/mask policies.
This method has no effect on TextRedactionPolicy::Full because full
redaction replaces the entire value with a placeholder string rather
than masking individual characters.
Trait Implementations§
Source§impl Clone for TextRedactionPolicy
impl Clone for TextRedactionPolicy
Source§fn clone(&self) -> TextRedactionPolicy
fn clone(&self) -> TextRedactionPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more