pub struct Replacer {
pub regex: Option<Regex>,
pub hints: Option<Vec<String>>,
pub repl: Option<Vec<u8>>,
pub repl_func: Option<Box<dyn Fn(&[u8]) -> Vec<u8> + Send + Sync>>,
}
Expand description
Defines a rule for scrubbing sensitive information.
Fields§
§regex: Option<Regex>
regex
must match the sensitive information within a value.
hints: Option<Vec<String>>
hints
, if given, are strings which must also be present in the text for the
regex
to match. This can be used to limit the contexts where an otherwise
very broad regex
is actually applied.
repl: Option<Vec<u8>>
repl
is the byte slice to replace the substring matching regex
. It can use
the regex
crate’s replacement-string syntax (e.g., $1
to refer to the
first capture group).
repl_func: Option<Box<dyn Fn(&[u8]) -> Vec<u8> + Send + Sync>>
repl_func
, if set, is called with the matched byte slice. The return value
is used as the replacement. Only one of repl
and repl_func
should be set.
Auto Trait Implementations§
impl Freeze for Replacer
impl !RefUnwindSafe for Replacer
impl Send for Replacer
impl Sync for Replacer
impl Unpin for Replacer
impl !UnwindSafe for Replacer
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Instruments this type by attaching the given allocation group token, returning a
Tracked
wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Instruments this type by attaching the current allocation group, returning a
Tracked
wrapper. Read more