pub struct Secret(/* private fields */);Available on crate feature
alloc only.Expand description
A text field that holds a secret (a password, a token).
No Display, no Clone (a clone is a second copy to wipe), no way to
take the String out: expose is the only way to read
it, which makes every read easy to find in review. The bytes are wiped
on drop with crypt-io’s volatile wipe; Debug prints Secret(..).
§Examples
use form_net::Secret;
let s = Secret::from(String::from("hunter2"));
assert_eq!(s.expose(), "hunter2");
assert_eq!(format!("{s:?}"), "Secret(..)");Implementations§
Trait Implementations§
Source§impl FromField for Secret
impl FromField for Secret
Source§fn accept_text(slot: &mut Self::Slot, value: &str) -> Result<(), ValueError>
fn accept_text(slot: &mut Self::Slot, value: &str) -> Result<(), ValueError>
Takes one text value. Read more
Source§fn finish(slot: Self::Slot) -> Result<Self, ValueError>
fn finish(slot: Self::Slot) -> Result<Self, ValueError>
The value, once every field has arrived. Read more
Source§fn accept_file(
slot: &mut Self::Slot,
file: FileValue<'_>,
) -> Result<(), ValueError>
fn accept_file( slot: &mut Self::Slot, file: FileValue<'_>, ) -> Result<(), ValueError>
Takes one file. Read more
Auto Trait Implementations§
impl Freeze for Secret
impl RefUnwindSafe for Secret
impl Send for Secret
impl Sync for Secret
impl Unpin for Secret
impl UnsafeUnpin 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