pub struct Redactor { /* private fields */ }Expand description
Configurable redaction builder for secrets and legacy field names.
Redactor encapsulates redaction policy and custom secret field names.
Build with Redactor::new(), configure via builder methods, then pass to
redaction functions like redacted_value or redact_url_secrets.
Implementations§
Source§impl Redactor
impl Redactor
Sourcepub fn secret_names<I: IntoIterator<Item = S>, S: Into<String>>(
self,
names: I,
) -> Self
pub fn secret_names<I: IntoIterator<Item = S>, S: Into<String>>( self, names: I, ) -> Self
Set custom field names to treat as secrets in addition to _secret suffixes.
Matching is exact field-name equality at any nesting level. The same
list also matches URL query-parameter names inside _url fields.
Builder style: returns self.
Sourcepub fn policy(self, policy: RedactionPolicy) -> Self
pub fn policy(self, policy: RedactionPolicy) -> Self
Set the redaction policy (default: full redaction).
Builder style: returns self.
Sourcepub fn value(&self, value: &Value) -> Value
pub fn value(&self, value: &Value) -> Value
Redact a JSON value copy using this redactor’s policy and secret names.
Sourcepub fn url(&self, url: &str) -> String
pub fn url(&self, url: &str) -> String
Redact secret components of a URL string using this redactor’s settings.
A query parameter is redacted iff its (form-decoded) name ends in
_secret/_SECRET or matches an exact entry in secret_names. The
userinfo password (scheme://user:pass@host) is always redacted as a
structural rule. Only the secret spans are replaced with ***; every
other byte is preserved. A string that is not a single, whitespace-free,
scheme-prefixed URL (including a URL embedded in surrounding prose) is
returned unchanged.
Trait Implementations§
impl Eq for Redactor
Source§impl From<RedactionPolicy> for Redactor
impl From<RedactionPolicy> for Redactor
Source§fn from(policy: RedactionPolicy) -> Self
fn from(policy: RedactionPolicy) -> Self
impl StructuralPartialEq for Redactor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.