pub struct MaskingPolicy { /* private fields */ }Expand description
Mask policies assigned to all supported sensitivity levels.
§Examples
use qubit_redact::MaskingPolicy;
use qubit_redact::Sensitivity;
let masking = MaskingPolicy::builder().build();
assert_eq!(masking.mask(Sensitivity::Secret, "raw"), "<redacted>");Implementations§
Source§impl MaskingPolicy
impl MaskingPolicy
Sourcepub fn builder() -> MaskingPolicyBuilder
pub fn builder() -> MaskingPolicyBuilder
Creates a builder initialized with the standard masking policies.
§Returns
A builder with the standard mask for each sensitivity level.
Sourcepub const fn for_level(&self, level: Sensitivity) -> &MaskPolicy
pub const fn for_level(&self, level: Sensitivity) -> &MaskPolicy
Sourcepub fn mask<'a>(&self, level: Sensitivity, value: &'a str) -> Cow<'a, str>
pub fn mask<'a>(&self, level: Sensitivity, value: &'a str) -> Cow<'a, str>
Masks value with the policy configured for level.
Empty values remain empty; otherwise the selected policy determines whether the result borrows or owns its contents.
§Type Parameters
'a- Lifetime of the input and any borrowed result.
§Parameters
level- Sensitivity level selecting the mask policy.value- Value to mask.
§Returns
The borrowed empty input or an owned masked value.
Sourcepub fn mask_opaque(&self, level: Sensitivity) -> &str
pub fn mask_opaque(&self, level: Sensitivity) -> &str
Returns the configured complete replacement for an opaque value.
This never reads the original value. Edge-preserving policies return only their replacement text because no prefix or suffix is safe to retain when the value is opaque.
§Parameters
level- Sensitivity level selecting the mask policy.
§Returns
The complete replacement configured for level.
Trait Implementations§
Source§impl Clone for MaskingPolicy
impl Clone for MaskingPolicy
Source§fn clone(&self) -> MaskingPolicy
fn clone(&self) -> MaskingPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MaskingPolicy
impl Debug for MaskingPolicy
Source§impl Default for MaskingPolicy
impl Default for MaskingPolicy
impl Eq for MaskingPolicy
Source§impl PartialEq for MaskingPolicy
impl PartialEq for MaskingPolicy
impl StructuralPartialEq for MaskingPolicy
Auto Trait Implementations§
impl Freeze for MaskingPolicy
impl RefUnwindSafe for MaskingPolicy
impl Send for MaskingPolicy
impl Sync for MaskingPolicy
impl Unpin for MaskingPolicy
impl UnsafeUnpin for MaskingPolicy
impl UnwindSafe for MaskingPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more