pub struct Cookie { /* private fields */ }
Implementations
sourceimpl Cookie
impl Cookie
sourcepub fn new(name: impl AsRef<str>, value: AsciiString) -> Self
pub fn new(name: impl AsRef<str>, value: AsciiString) -> Self
Makes a new cookie with the specified name and value.
The cookie has max_age
set to 30 days,
same_site
strict,
secure
true,
and http_only
true.
Panics
Panics when name
is empty.
Panics when name
is not US-ASCII.
sourcepub fn with_domain(self, d: impl AsRef<str>) -> Self
pub fn with_domain(self, d: impl AsRef<str>) -> Self
Panics
Panics when domain
is not US-ASCII.
sourcepub fn with_expires(self, t: SystemTime) -> Self
pub fn with_expires(self, t: SystemTime) -> Self
To un-set this value, pass SystemTime::UNIX_EPOCH
.
pub fn with_http_only(self, b: bool) -> Self
sourcepub fn with_max_age(self, d: Duration) -> Self
pub fn with_max_age(self, d: Duration) -> Self
To un-set duration, pass Duration::ZERO
.
pub fn with_same_site(self, s: SameSite) -> Self
pub fn with_secure(self, b: bool) -> Self
Trait Implementations
sourceimpl From<Cookie> for AsciiString
impl From<Cookie> for AsciiString
sourceimpl Ord for Cookie
impl Ord for Cookie
sourceimpl PartialOrd<Cookie> for Cookie
impl PartialOrd<Cookie> for Cookie
sourcefn partial_cmp(&self, other: &Cookie) -> Option<Ordering>
fn partial_cmp(&self, other: &Cookie) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Cookie
impl StructuralEq for Cookie
impl StructuralPartialEq for Cookie
Auto Trait Implementations
impl RefUnwindSafe for Cookie
impl Send for Cookie
impl Sync for Cookie
impl Unpin for Cookie
impl UnwindSafe for Cookie
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more