Skip to main content

EnvRedactor

Struct EnvRedactor 

Source
pub struct EnvRedactor { /* private fields */ }
Expand description

Applies one immutable redaction policy to environment-variable values.

Implementations§

Source§

impl EnvRedactor

Source

pub const fn new(redactor: Redactor) -> Self

Creates an environment redactor from a core redactor.

§Parameters
  • redactor - Core redactor whose immutable policy will be used.
§Returns

An environment redactor owning the supplied policy snapshot.

Source

pub const fn redactor(&self) -> &Redactor

Returns the core redactor backing this adapter.

§Returns

A borrowed view of the core redactor.

Source

pub fn redact_pair(&self, name: &str, value: &str) -> RedactedEnvPair

Redacts one UTF-8 environment-variable pair.

Both components are escaped before they can be displayed. The value is classified from name using the adapter’s immutable policy.

§Parameters
  • name - Environment-variable name used for classification.
  • value - Environment-variable value to redact when sensitive.
§Returns

A log-safe pair rendered as NAME=VALUE.

Source

pub fn redact_pair_with_session( &self, name: &str, value: &str, session: &RedactionSession<'_>, ) -> RedactedEnvPair

Redacts one UTF-8 pair through a shared operation session.

Source

pub fn redact_os_pair(&self, name: &OsStr, value: &OsStr) -> RedactedEnvPair

Redacts one environment pair whose components may not be UTF-8.

If either component is invalid UTF-8, the original value is never rendered or supplied to an edge-preserving mask. Instead, the secret opaque replacement is used. A non-UTF-8 name is rendered lossily and escaped for diagnostics.

§Parameters
  • name - Operating-system environment-variable name.
  • value - Operating-system environment-variable value.
§Returns

A fail-closed, log-safe pair rendered as NAME=VALUE.

Source

pub fn redact_os_pairs<'a, I>(&self, pairs: I) -> LogSafeText<'static>
where I: IntoIterator<Item = (&'a OsStr, &'a OsStr)>,

Redacts environment pairs into one bounded log-safe list.

The adapter stops before inspecting a pair that would exceed the policy’s diagnostic input budget. It also stops once the escaped list reaches the diagnostic output budget.

§Type Parameters
  • 'a - Lifetime of environment names and values yielded by the iterator.
  • I - Iterator source yielding borrowed environment pairs.
§Parameters
  • pairs - Operating-system environment names and values to redact.
§Returns

A debug-style log-safe list of redacted assignments.

Source

pub fn redact_os_pairs_with_session<'a, I>( &self, pairs: I, session: &RedactionSession<'_>, ) -> LogSafeText<'static>
where I: IntoIterator<Item = (&'a OsStr, &'a OsStr)>,

Redacts environment pairs through one cumulative diagnostic session.

Source

pub fn redact_assignment(&self, assignment: &str) -> RedactedEnvPair

Redacts one UTF-8 NAME=value assignment.

Input without = is treated as a name with an empty value and therefore renders as NAME=.

§Parameters
  • assignment - Assignment text to split at its first equals sign.
§Returns

A log-safe pair rendered as NAME=VALUE.

Trait Implementations§

Source§

impl Clone for EnvRedactor

Source§

fn clone(&self) -> EnvRedactor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnvRedactor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnvRedactor

Source§

fn default() -> Self

Creates an environment redactor from the current default policy snapshot.

§Returns

An environment redactor backed by Redactor::default.

Source§

impl Eq for EnvRedactor

Source§

impl PartialEq for EnvRedactor

Source§

fn eq(&self, other: &EnvRedactor) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EnvRedactor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.