pub struct Cookie<'a>(/* private fields */);Available on crate feature
cookies only.Expand description
A parsed HTTP cookie.
Implementations§
Source§impl<'a> Cookie<'a>
impl<'a> Cookie<'a>
Sourcepub fn same_site_lax(&self) -> bool
pub fn same_site_lax(&self) -> bool
Returns whether the SameSite attribute of this cookie is Lax.
Sourcepub fn same_site_strict(&self) -> bool
pub fn same_site_strict(&self) -> bool
Returns whether the SameSite attribute of this cookie is Strict.
Sourcepub fn domain(&self) -> Option<&str>
pub fn domain(&self) -> Option<&str>
Returns the Domain of the cookie if one was specified.
This does not consider whether the Domain is valid; validation is left to higher-level
libraries, as needed. However, if the Domain starts with a leading ., the leading . is
stripped.
Sourcepub fn max_age(&self) -> Option<Duration>
pub fn max_age(&self) -> Option<Duration>
Returns the specified max-age of the cookie if it is non-negative and representable.
Sourcepub fn expires(&self) -> Option<SystemTime>
pub fn expires(&self) -> Option<SystemTime>
Returns the expiration date-time of the cookie if one was specified.
Session cookies return None.
Sourcepub fn into_owned(self) -> Cookie<'static>
pub fn into_owned(self) -> Cookie<'static>
Converts self into a Cookie with a static lifetime with as few allocations as possible.
Trait Implementations§
Source§impl IntoCookie for Cookie<'_>
impl IntoCookie for Cookie<'_>
Converts this value into an optional owned
Cookie.Auto Trait Implementations§
impl<'a> Freeze for Cookie<'a>
impl<'a> RefUnwindSafe for Cookie<'a>
impl<'a> Send for Cookie<'a>
impl<'a> Sync for Cookie<'a>
impl<'a> Unpin for Cookie<'a>
impl<'a> UnsafeUnpin for Cookie<'a>
impl<'a> UnwindSafe for Cookie<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more