pub struct Sensitive<T>(pub T);
Expand description
A wrapper used to modify the Display
and Debug
implementation of the inner structure
based on the feature flag unredacted-logging
. When the unredacted-logging
feature is enabled, the
implementations will defer to those on T
, when disabled they will defer to REDACTED
.
Note that there are Display
and Debug
implementations for &T
where T: Display
and T: Debug
respectively - wrapping references is allowed for the cases when consuming the
inner struct is not desired.
§Example
tracing::debug!(
name = %Sensitive("Alice"),
friends = ?Sensitive(["Bob"]),
address = ?Sensitive(&address)
);
Tuple Fields§
§0: T
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Sensitive<T>where
T: Freeze,
impl<T> RefUnwindSafe for Sensitive<T>where
T: RefUnwindSafe,
impl<T> Send for Sensitive<T>where
T: Send,
impl<T> Sync for Sensitive<T>where
T: Sync,
impl<T> Unpin for Sensitive<T>where
T: Unpin,
impl<T> UnwindSafe for Sensitive<T>where
T: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.