pub struct Cookie { /* private fields */ }Expand description
Framework-owned response cookie primitives. A response cookie with secure defaults.
Implementations§
Source§impl Cookie
impl Cookie
Sourcepub fn new(name: impl Into<String>, value: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self
Creates a cookie with secure framework defaults.
Sourcepub fn removal(name: impl Into<String>) -> Self
pub fn removal(name: impl Into<String>) -> Self
Creates an expired cookie suitable for removing a stored cookie.
Sourcepub fn expires(self, value: SystemTime) -> Self
pub fn expires(self, value: SystemTime) -> Self
Sets the absolute expiry time.
Sourcepub fn is_http_only(&self) -> bool
pub fn is_http_only(&self) -> bool
Returns whether HttpOnly is enabled.
Sourcepub fn same_site_value(&self) -> SameSite
pub fn same_site_value(&self) -> SameSite
Returns the SameSite policy.
Sourcepub fn path_value(&self) -> Option<&str>
pub fn path_value(&self) -> Option<&str>
Returns the configured path.
Sourcepub fn domain_value(&self) -> Option<&str>
pub fn domain_value(&self) -> Option<&str>
Returns the configured domain.
Sourcepub fn max_age_value(&self) -> Option<Duration>
pub fn max_age_value(&self) -> Option<Duration>
Returns the configured relative lifetime.
Sourcepub fn expires_value(&self) -> Option<SystemTime>
pub fn expires_value(&self) -> Option<SystemTime>
Returns the configured absolute expiry time.
Sourcepub fn to_header_value(&self) -> String
pub fn to_header_value(&self) -> String
Serializes this cookie for a Set-Cookie header.
Trait Implementations§
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 UnsafeUnpin 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