pub struct Secret<T>(/* private fields */);Expand description
A credential or other value that must not reach a log.
Its Debug prints Secret([REDACTED]) whatever it holds, and it has no
Display, so a struct that derives Debug can carry one safely. Read the
value with expose, at the one place that needs it.
use polyoxide_venue::Secret;
let key = Secret::new(String::from("hunter2"));
assert_eq!(format!("{key:?}"), "Secret([REDACTED])");
assert_eq!(key.expose(), "hunter2");Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Secret<T>where
T: Freeze,
impl<T> RefUnwindSafe for Secret<T>where
T: RefUnwindSafe,
impl<T> Send for Secret<T>where
T: Send,
impl<T> Sync for Secret<T>where
T: Sync,
impl<T> Unpin for Secret<T>where
T: Unpin,
impl<T> UnsafeUnpin for Secret<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Secret<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