pub struct Redactor { /* private fields */ }Expand description
Redactor for detecting and redacting sensitive data.
Implementations§
Source§impl Redactor
impl Redactor
Sourcepub fn with_patterns(
pii_patterns: Vec<Regex>,
secret_patterns: Vec<Regex>,
) -> Self
pub fn with_patterns( pii_patterns: Vec<Regex>, secret_patterns: Vec<Regex>, ) -> Self
Create a redactor with custom patterns.
Sourcepub fn contains_pii(&self, value: &str) -> bool
pub fn contains_pii(&self, value: &str) -> bool
Check if a value contains PII.
Sourcepub fn contains_secret(&self, value: &str) -> bool
pub fn contains_secret(&self, value: &str) -> bool
Check if a value contains secrets/tokens.
Sourcepub fn redact(&self, value: &str, redaction: Redaction) -> String
pub fn redact(&self, value: &str, redaction: Redaction) -> String
Redact sensitive data in a string.
Sourcepub fn redact_field(&self, field_name: &str, value: &str) -> String
pub fn redact_field(&self, field_name: &str, value: &str) -> String
Redact a field value based on its name.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Redactor
impl RefUnwindSafe for Redactor
impl Send for Redactor
impl Sync for Redactor
impl Unpin for Redactor
impl UnwindSafe for Redactor
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