pub struct SensitiveFieldDetector { /* private fields */ }Expand description
敏感字段检测器:基于字段名模式自动检测敏感字段并推荐脱敏规则。
内置常见敏感字段模式(phone/mobile/tel、email/mail、idcard/identity、 bankcard/card、password/pwd、name、address/addr、ip 等), 也支持自定义模式。
Implementations§
Source§impl SensitiveFieldDetector
impl SensitiveFieldDetector
Sourcepub fn add_pattern(self, pattern: FieldPattern) -> Self
pub fn add_pattern(self, pattern: FieldPattern) -> Self
添加自定义模式(链式)
Sourcepub fn pattern_count(&self) -> usize
pub fn pattern_count(&self) -> usize
模式数
Sourcepub fn detect(&self, field: &str) -> Option<&MaskingRule>
pub fn detect(&self, field: &str) -> Option<&MaskingRule>
检测字段名对应的脱敏规则
Sourcepub fn detect_fields(&self, fields: &[String]) -> Vec<(String, &MaskingRule)>
pub fn detect_fields(&self, fields: &[String]) -> Vec<(String, &MaskingRule)>
批量检测字段名,返回 (字段名, 规则) 列表
Sourcepub fn auto_rules(&self, fields: &[String]) -> HashMap<String, MaskingRule>
pub fn auto_rules(&self, fields: &[String]) -> HashMap<String, MaskingRule>
为字段列表自动生成脱敏规则 HashMap
Trait Implementations§
Source§impl Clone for SensitiveFieldDetector
impl Clone for SensitiveFieldDetector
Source§fn clone(&self) -> SensitiveFieldDetector
fn clone(&self) -> SensitiveFieldDetector
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 SensitiveFieldDetector
impl Debug for SensitiveFieldDetector
Source§impl Default for SensitiveFieldDetector
impl Default for SensitiveFieldDetector
Source§fn default() -> SensitiveFieldDetector
fn default() -> SensitiveFieldDetector
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SensitiveFieldDetector
impl RefUnwindSafe for SensitiveFieldDetector
impl Send for SensitiveFieldDetector
impl Sync for SensitiveFieldDetector
impl Unpin for SensitiveFieldDetector
impl UnsafeUnpin for SensitiveFieldDetector
impl UnwindSafe for SensitiveFieldDetector
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