pub enum SameSite {
Strict,
Lax,
None,
}
Expand description
The SameSite
cookie attribute.
A cookie with a SameSite
attribute is imposed restrictions on when it is
sent to the origin server in a cross-site request. If the SameSite
attribute is “Strict”, then the cookie is never sent in cross-site requests.
If the SameSite
attribute is “Lax”, the cookie is only sent in cross-site
requests with “safe” HTTP methods, i.e, GET
, HEAD
, OPTIONS
, TRACE
.
If the SameSite
attribute is not present (made explicit via the
SameSite::None
variant), then the cookie will be sent as normal.
Note: This cookie attribute is an HTTP draft! Its meaning and definition are subject to change.
Variants§
Strict
The “Strict” SameSite
attribute.
Lax
The “Lax” SameSite
attribute.
None
No SameSite
attribute.
Implementations§
source§impl SameSite
impl SameSite
sourcepub fn is_strict(&self) -> bool
pub fn is_strict(&self) -> bool
Returns true
if self
is SameSite::Strict
and false
otherwise.
§Example
use cookie::SameSite;
let strict = SameSite::Strict;
assert!(strict.is_strict());
assert!(!strict.is_lax());
assert!(!strict.is_none());
Trait Implementations§
impl Copy for SameSite
impl Eq for SameSite
impl StructuralPartialEq for SameSite
Auto Trait Implementations§
impl Freeze for SameSite
impl RefUnwindSafe for SameSite
impl Send for SameSite
impl Sync for SameSite
impl Unpin for SameSite
impl UnwindSafe for SameSite
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.