[][src]Struct wasm_cookies::CookieOptions

pub struct CookieOptions<'a> {
    pub path: Option<&'a str>,
    pub domain: Option<&'a str>,
    pub expires: Option<String>,
    pub secure: bool,
    pub same_site: SameSite,
}

Cookies options (see https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie).

You can create it by calling CookieOptions::default().

Fields

path: Option<&'a str>

If None, defaults to the current path of the current document location.

domain: Option<&'a str>

If None, defaults to the host portion of the current document location.

expires: Option<String>

Expiration date in GMT string format. If None, the cookie will expire at the end of session.

secure: bool

If true, the cookie will only be transmitted over secure protocol as HTTPS. The default value is false.

same_site: SameSite

SameSite prevents the browser from sending the cookie along with cross-site requests (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_attribute).

Implementations

impl<'a> CookieOptions<'a>[src]

pub fn with_path(self, path: &'a str) -> Self[src]

Set the path. The default value is the current path of the current document location.

pub fn with_domain(self, domain: &'a str) -> Self[src]

Set the domain. The default value is the host portion of the current document location.

pub fn expires_at_date(self, date: &Date) -> Self[src]

Expires the cookie at a specific date. The default behavior of the cookie is to expire at the end of session.

pub fn expires_at_timestamp(self, timestamp: u64) -> Self[src]

Expires the cookie at a specific timestamp (in seconds). The default behavior of the cookie is to expire at the end of session.

pub fn expires_after(self, duration: Duration) -> Self[src]

Expires the cookie after a certain duration. The default behavior of the cookie is to expire at the end of session.

pub fn secure(self) -> Self[src]

Set the cookie to be only transmitted over secure protocol as HTTPS.

pub fn with_same_site(self, same_site: SameSite) -> Self[src]

Set the SameSite value. SameSite prevents the browser from sending the cookie along with cross-site requests (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#SameSite_attribute).

Trait Implementations

impl<'a> Clone for CookieOptions<'a>[src]

impl<'a> Debug for CookieOptions<'a>[src]

impl<'a> Default for CookieOptions<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for CookieOptions<'a>

impl<'a> Send for CookieOptions<'a>

impl<'a> Sync for CookieOptions<'a>

impl<'a> Unpin for CookieOptions<'a>

impl<'a> UnwindSafe for CookieOptions<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.