pub struct Inspector { /* private fields */ }Expand description
Scans input text against a RuleSet.
Building an inspector compiles every pattern, so build once and reuse it.
Inspector is Send + Sync.
Implementations§
Source§impl Inspector
impl Inspector
Sourcepub fn with_default_rules() -> Self
pub fn with_default_rules() -> Self
An inspector with the bundled default rules.
§Panics
Never in practice: the bundled rules are compiled in the crate’s tests.
Sourcepub fn scan(&self, text: &str) -> Report
pub fn scan(&self, text: &str) -> Report
Scans text and returns every finding plus an overall decision.
Sourcepub fn redact(&self, text: &str) -> Redacted
pub fn redact(&self, text: &str) -> Redacted
Scans text and replaces every finding whose category is listed in
Policy::redact with a marker.
Overlapping findings are merged; the marker of the first (highest severity) finding wins. Injection findings are not redacted by default because masking an instruction does not make it safe to forward.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Inspector
impl Freeze for Inspector
impl RefUnwindSafe for Inspector
impl Send for Inspector
impl Sync for Inspector
impl Unpin for Inspector
impl UnsafeUnpin for Inspector
impl UnwindSafe for Inspector
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