pub struct Cookie { /* private fields */ }Implementations§
Source§impl 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§
Source§impl From<Cookie> for AsciiString
impl From<Cookie> for AsciiString
Source§impl Ord for Cookie
impl Ord for Cookie
Source§impl PartialOrd for Cookie
impl PartialOrd for Cookie
impl Eq for Cookie
impl StructuralPartialEq for Cookie
Auto Trait Implementations§
impl Freeze for Cookie
impl RefUnwindSafe for Cookie
impl Send for Cookie
impl Sync for Cookie
impl Unpin for Cookie
impl UnwindSafe for Cookie
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