pub struct EntityDetector { /* private fields */ }Expand description
Entity-aware detector using regex patterns plus check-digit validation where applicable.
PANs are validated with Luhn; CPFs and CNPJs with the Brazilian mod-11 algorithm. This sharply reduces false positives on random numeric strings (invoice numbers, order IDs, etc.) that share the same shape as real identifiers.
A RegexSet prefilter runs first: one multi-pattern pass identifies
which categories appear at all, so a clean string (the common case) pays a
single scan instead of eight independent find_iter passes.
Implementations§
Source§impl EntityDetector
impl EntityDetector
Sourcepub fn new(enabled: CategorySet) -> Result<Self, Error>
pub fn new(enabled: CategorySet) -> Result<Self, Error>
Construct a detector with an explicit category toggle set.
§Errors
Returns a regex::Error if any internal pattern fails to
compile.
Trait Implementations§
Source§impl Debug for EntityDetector
impl Debug for EntityDetector
Source§impl PiiDetector for EntityDetector
impl PiiDetector for EntityDetector
Auto Trait Implementations§
impl Freeze for EntityDetector
impl RefUnwindSafe for EntityDetector
impl Send for EntityDetector
impl Sync for EntityDetector
impl Unpin for EntityDetector
impl UnsafeUnpin for EntityDetector
impl UnwindSafe for EntityDetector
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