pub struct FormAuthenticityToken(/* private fields */);Implementations§
Source§impl FormAuthenticityToken
impl FormAuthenticityToken
Sourcepub fn generate<R>(rng: &mut R) -> Self
pub fn generate<R>(rng: &mut R) -> Self
Generates a random token.
§Examples
use asjeeves_csrf::FormAuthenticityToken;
use rand_chacha::ChaCha20Rng;
use rand_core::SeedableRng;
let mut rng = ChaCha20Rng::from_seed(Default::default());
let fat = FormAuthenticityToken::generate(&mut rng);
Returns a cookie with the token formatted for csrf Secure; SameSite=Strict; HttpOnly; Path=/
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl AsRef<str> for FormAuthenticityToken
impl AsRef<str> for FormAuthenticityToken
Source§impl Clone for FormAuthenticityToken
impl Clone for FormAuthenticityToken
Source§fn clone(&self) -> FormAuthenticityToken
fn clone(&self) -> FormAuthenticityToken
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FormAuthenticityToken
impl Debug for FormAuthenticityToken
Source§impl Display for FormAuthenticityToken
impl Display for FormAuthenticityToken
Source§impl<'a> From<&Cookie<'a>> for FormAuthenticityToken
impl<'a> From<&Cookie<'a>> for FormAuthenticityToken
Source§impl From<HeaderValue> for FormAuthenticityToken
impl From<HeaderValue> for FormAuthenticityToken
Source§fn from(value: HeaderValue) -> Self
fn from(value: HeaderValue) -> Self
Converts to this type from the input type.
Source§impl<S> OptionalFromRequestParts<S> for FormAuthenticityToken
impl<S> OptionalFromRequestParts<S> for FormAuthenticityToken
Source§impl PartialEq for FormAuthenticityToken
impl PartialEq for FormAuthenticityToken
impl StructuralPartialEq for FormAuthenticityToken
Auto Trait Implementations§
impl Freeze for FormAuthenticityToken
impl RefUnwindSafe for FormAuthenticityToken
impl Send for FormAuthenticityToken
impl Sync for FormAuthenticityToken
impl Unpin for FormAuthenticityToken
impl UnsafeUnpin for FormAuthenticityToken
impl UnwindSafe for FormAuthenticityToken
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