pub struct SensitiveValue<T, P>(/* private fields */);Expand description
Wrapper for leaf values to apply a redaction policy.
For external types, implement SensitiveWithPolicy<P> in your crate and
wrap the value in SensitiveValue<T, P> to apply the policy.
Serialization: when the json feature is enabled, serde::Serialize
emits the raw inner value unchanged. This is intentional. If you need
redacted JSON, use .redacted(), .to_redacted_output(), or
redacted_json() (from RedactedJsonExt) at the logging/serialization
boundary instead of serializing the wrapper directly.
Leaf values are atomic: SensitiveValue treats T as an opaque unit
and does not traverse its fields.
Implementations§
Source§impl<T, P> SensitiveValue<T, P>where
T: SensitiveWithPolicy<P>,
P: RedactionPolicy,
impl<T, P> SensitiveValue<T, P>where
T: SensitiveWithPolicy<P>,
P: RedactionPolicy,
Source§impl<T, P> SensitiveValue<T, P>
impl<T, P> SensitiveValue<T, P>
Sourcepub fn expose(&self) -> &T
pub fn expose(&self) -> &T
Explicitly access the inner value.
This method makes it clear in your code that you are intentionally accessing the raw sensitive value. Use with care.
Sourcepub fn expose_mut(&mut self) -> &mut T
pub fn expose_mut(&mut self) -> &mut T
Explicitly access the inner value mutably.
This method makes it clear in your code that you are intentionally accessing the raw sensitive value. Use with care.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the wrapper and return the inner value.
Trait Implementations§
Source§impl<T: Clone, P: Clone> Clone for SensitiveValue<T, P>
impl<T: Clone, P: Clone> Clone for SensitiveValue<T, P>
Source§fn clone(&self) -> SensitiveValue<T, P>
fn clone(&self) -> SensitiveValue<T, P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T, P> Debug for SensitiveValue<T, P>where
T: SensitiveWithPolicy<P>,
P: RedactionPolicy,
impl<T, P> Debug for SensitiveValue<T, P>where
T: SensitiveWithPolicy<P>,
P: RedactionPolicy,
Source§impl<T: Default, P: Default> Default for SensitiveValue<T, P>
impl<T: Default, P: Default> Default for SensitiveValue<T, P>
Source§fn default() -> SensitiveValue<T, P>
fn default() -> SensitiveValue<T, P>
Source§impl<T, P> From<T> for SensitiveValue<T, P>
impl<T, P> From<T> for SensitiveValue<T, P>
Source§impl<T: Ord, P: Ord> Ord for SensitiveValue<T, P>
impl<T: Ord, P: Ord> Ord for SensitiveValue<T, P>
Source§fn cmp(&self, other: &SensitiveValue<T, P>) -> Ordering
fn cmp(&self, other: &SensitiveValue<T, P>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialOrd, P: PartialOrd> PartialOrd for SensitiveValue<T, P>
impl<T: PartialOrd, P: PartialOrd> PartialOrd for SensitiveValue<T, P>
Source§impl<T, P> ToRedactedOutput for SensitiveValue<T, P>where
T: SensitiveWithPolicy<P>,
P: RedactionPolicy,
impl<T, P> ToRedactedOutput for SensitiveValue<T, P>where
T: SensitiveWithPolicy<P>,
P: RedactionPolicy,
fn to_redacted_output(&self) -> RedactedOutput
impl<T: Eq, P: Eq> Eq for SensitiveValue<T, P>
impl<T, P> StructuralPartialEq for SensitiveValue<T, P>
Auto Trait Implementations§
impl<T, P> Freeze for SensitiveValue<T, P>where
T: Freeze,
impl<T, P> RefUnwindSafe for SensitiveValue<T, P>where
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for SensitiveValue<T, P>
impl<T, P> Sync for SensitiveValue<T, P>
impl<T, P> Unpin for SensitiveValue<T, P>
impl<T, P> UnwindSafe for SensitiveValue<T, P>where
T: UnwindSafe,
P: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> NotSensitiveDebugExt for Twhere
T: Debug,
impl<T> NotSensitiveDebugExt for Twhere
T: Debug,
Source§fn not_sensitive_debug(&self) -> NotSensitiveDebug<&Self>
fn not_sensitive_debug(&self) -> NotSensitiveDebug<&Self>
Debug.