pub struct Secret(/* private fields */);
Expand description
Newtype (pattern) to protect secret credentials stored as Strings.
Trait Implementations§
Source§impl AsRef<str> for Secret
Allow dereferencing Secrets as &str.
impl AsRef<str> for Secret
Allow dereferencing Secrets as &str.
assert_eq!(Secret::from("hello".to_string()).as_ref(), "hello");
Source§impl Debug for Secret
Secrets must not leak, so make sure they are not printed.
impl Debug for Secret
Secrets must not leak, so make sure they are not printed.
assert_eq!(format!("{:?}",Secret::from("hello".to_string())), "\"*******\"");
Source§impl Display for Secret
Secrets must not leak, so make sure they are not displayed.
impl Display for Secret
Secrets must not leak, so make sure they are not displayed.
assert_eq!(format!("{}",Secret::from("hello".to_string())), "*******");
Auto Trait Implementations§
impl Freeze for Secret
impl RefUnwindSafe for Secret
impl Send for Secret
impl Sync for Secret
impl Unpin for Secret
impl UnwindSafe for Secret
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