pub struct MaskingPolicy { /* private fields */ }Expand description
脱敏策略:为多个字段定义脱敏规则,批量应用
Implementations§
Source§impl MaskingPolicy
impl MaskingPolicy
Sourcepub fn add_rule(&mut self, field: &str, rule: MaskingRule) -> &mut Self
pub fn add_rule(&mut self, field: &str, rule: MaskingRule) -> &mut Self
添加字段脱敏规则(链式)
Sourcepub fn get_rule(&self, field: &str) -> Option<&MaskingRule>
pub fn get_rule(&self, field: &str) -> Option<&MaskingRule>
获取某字段的脱敏规则
Sourcepub fn remove_rule(&mut self, field: &str) -> Option<MaskingRule>
pub fn remove_rule(&mut self, field: &str) -> Option<MaskingRule>
移除某字段的脱敏规则
Sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
已注册字段数
Sourcepub fn rules(&self) -> &HashMap<String, MaskingRule>
pub fn rules(&self) -> &HashMap<String, MaskingRule>
获取所有规则引用
Sourcepub fn apply_to_map(
&self,
data: &HashMap<String, String>,
) -> HashMap<String, String>
pub fn apply_to_map( &self, data: &HashMap<String, String>, ) -> HashMap<String, String>
对 HashMap 数据应用脱敏
Sourcepub fn apply_to_json(&self, json: &str) -> String
pub fn apply_to_json(&self, json: &str) -> String
对 JSON 字符串应用脱敏
Trait Implementations§
Source§impl Clone for MaskingPolicy
impl Clone for MaskingPolicy
Source§fn clone(&self) -> MaskingPolicy
fn clone(&self) -> MaskingPolicy
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 MaskingPolicy
impl Debug for MaskingPolicy
Source§impl Default for MaskingPolicy
impl Default for MaskingPolicy
Source§fn default() -> MaskingPolicy
fn default() -> MaskingPolicy
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MaskingPolicy
impl RefUnwindSafe for MaskingPolicy
impl Send for MaskingPolicy
impl Sync for MaskingPolicy
impl Unpin for MaskingPolicy
impl UnsafeUnpin for MaskingPolicy
impl UnwindSafe for MaskingPolicy
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