pub struct Redactor { /* private fields */ }Expand description
Compiled redactor. Construct via from_config (returns disabled
passthrough when cfg.enabled == false) or disabled().
Implementations§
Source§impl Redactor
impl Redactor
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
Disabled passthrough — apply returns the input unchanged with
empty hits.
pub fn from_config(cfg: &RedactionConfig) -> Result<Self>
pub fn is_active(&self) -> bool
Sourcepub fn apply(&self, input: &str) -> RedactionReport
pub fn apply(&self, input: &str) -> RedactionReport
Apply every loaded rule in declared order. Each pattern runs
over the already-replaced text, so a later pattern can
match tokens emitted by earlier [REDACTED:<label>] markers.
Built-in patterns are designed not to collide with the
[REDACTED:...] shape, but operators should keep the same
invariant when shipping extra_patterns — a pattern that
matches REDACTED will produce nested markers
([REDACTED:[REDACTED:foo]]).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Redactor
impl RefUnwindSafe for Redactor
impl Send for Redactor
impl Sync for Redactor
impl Unpin for Redactor
impl UnsafeUnpin for Redactor
impl UnwindSafe for Redactor
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more