Enum http_types::cookies::SameSite [−][src]
pub enum SameSite {
Strict,
Lax,
None,
}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 “None”, the cookie is sent in all cross-site
requests if the “Secure” flag is also set, otherwise the cookie is ignored.
This library automatically sets the “Secure” flag on cookies when
same_site is set to SameSite::None as long as secure is not explicitly
set to false.
If the SameSite attribute is not present (by not setting SameSite
initally or passing None to Cookie::set_same_site()), 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
The “Strict” SameSite attribute.
The “Lax” SameSite attribute.
The “None” SameSite attribute.
Implementations
impl SameSite[src]
impl SameSite[src]pub fn is_strict(&self) -> bool[src]
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());
pub fn is_lax(&self) -> bool[src]
Returns true if self is SameSite::Lax and false otherwise.
Example
use cookie::SameSite; let lax = SameSite::Lax; assert!(lax.is_lax()); assert!(!lax.is_strict()); assert!(!lax.is_none());
pub fn is_none(&self) -> bool[src]
Returns true if self is SameSite::None and false otherwise.
Example
use cookie::SameSite; let none = SameSite::None; assert!(none.is_none()); assert!(!none.is_lax()); assert!(!none.is_strict());
Trait Implementations
impl StructuralEq for SameSite[src]
impl StructuralEq for SameSite[src]impl StructuralPartialEq for SameSite[src]
impl StructuralPartialEq for SameSite[src]Auto Trait Implementations
impl RefUnwindSafe for SameSite
impl RefUnwindSafe for SameSiteimpl UnwindSafe for SameSite
impl UnwindSafe for SameSiteBlanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for Ttype Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,