Cookie

Struct Cookie 

Source
pub struct Cookie {
    pub host: String,
    pub path: String,
    pub name: String,
    pub value: String,
    pub is_secure: bool,
    pub is_http_only: bool,
    pub creation_time: OffsetDateTime,
    pub expiration_time: Option<OffsetDateTime>,
    pub same_site: Option<SameSite>,
    pub last_accessed: Option<OffsetDateTime>,
}
Expand description

A single HTTP cookie.

Fields§

§host: String

The host (domain) with which the cookie is associated.

§path: String

The path under which the cookie should be used when making requests.

§name: String

The name of the cookie.

§value: String

The contents of the cookie.

§is_secure: bool

Whether the cookie should only be sent over encrypted channels (https).

§is_http_only: bool

Whether the cookie should be hidden from client-side scripting (javascript).

§creation_time: OffsetDateTime

When the cookie was first registered with the browser.

§expiration_time: Option<OffsetDateTime>

When the cookie will no longer be valid.

§same_site: Option<SameSite>

The SameSite setting for the cookie (which may not have been specified).

§last_accessed: Option<OffsetDateTime>

The last time the cookie was accessed by the browser (if this data is tracked).

Implementations§

Crafts a Set-Cookie header value corresponding to this cookie.

Source

pub fn get_url(&self) -> String

Creates a URL that could have feasibly responded with this cookie as a Set-Cookie header.

This URL is a guess based on the cookie’s domain and path; there is no guarantee that calls to this URL will set this cookie, or even that this URL will respond successfully.

Trait Implementations§

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

fn eq(&self, other: &Cookie) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V