pub struct ContentRedactor {
secret_detector: SecretDetector,
pii_detector: PiiDetector,
config: RedactionConfig,
}Expand description
Redacts sensitive content from text.
Fields§
§secret_detector: SecretDetector§pii_detector: PiiDetector§config: RedactionConfigImplementations§
Source§impl ContentRedactor
impl ContentRedactor
Sourcepub const fn with_config(config: RedactionConfig) -> Self
pub const fn with_config(config: RedactionConfig) -> Self
Creates a new content redactor with custom config.
Sourcepub const fn config(&self) -> &RedactionConfig
pub const fn config(&self) -> &RedactionConfig
Returns the configuration.
Sourcepub fn redact(&self, content: &str) -> String
pub fn redact(&self, content: &str) -> String
Redacts sensitive content, returning the redacted text.
Sourcepub fn redact_with_flag(&self, content: &str) -> (String, bool)
pub fn redact_with_flag(&self, content: &str) -> (String, bool)
Returns the redacted content and a flag indicating if anything was redacted.
Sourcepub fn needs_redaction(&self, content: &str) -> bool
pub fn needs_redaction(&self, content: &str) -> bool
Checks if content needs redaction.
Sourcepub fn detected_types(&self, content: &str) -> Vec<String>
pub fn detected_types(&self, content: &str) -> Vec<String>
Returns the types of sensitive content found.
Sourcefn get_replacement(&self, type_name: &str, length: usize) -> String
fn get_replacement(&self, type_name: &str, length: usize) -> String
Gets the replacement string based on mode.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContentRedactor
impl RefUnwindSafe for ContentRedactor
impl Send for ContentRedactor
impl Sync for ContentRedactor
impl Unpin for ContentRedactor
impl UnwindSafe for ContentRedactor
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