CookieOptions

Struct CookieOptions 

Source
pub struct CookieOptions {
    pub name: &'static str,
    pub path: &'static str,
    pub secure: bool,
    pub http_only: bool,
    pub max_age: Option<Duration>,
    pub domain: Option<&'static str>,
    pub same_site: Option<SameSite>,
}
Available on crate feature cookie only.
Expand description

Cookie’s Options

Fields§

§name: &'static str

Cookie’s name, viz.sid by defaults

§path: &'static str

Cookie’s path, / by defaults

§secure: bool

Cookie’s secure, true by defaults

§http_only: bool

Cookie’s http_only, true by defaults

§max_age: Option<Duration>

Cookie’s maximum age, 24H by defaults

§domain: Option<&'static str>

Cookie’s domain

§same_site: Option<SameSite>

Cookie’s same_site, Lax by defaults

Implementations§

Source§

impl CookieOptions

Source

pub const MAX_AGE: u64 = 86_400u64

By default 24h for cookie.

Source

pub fn new(name: &'static str) -> Self

Creates new CookieOptions

Source

pub const fn name(self, name: &'static str) -> Self

Creates new CookieOptions with name

Source

pub fn max_age(self, max_age: Duration) -> Self

Creates new CookieOptions with max_age

Source

pub fn domain(self, domain: &'static str) -> Self

Creates new CookieOptions with domain

Source

pub const fn path(self, path: &'static str) -> Self

Creates new CookieOptions with path

Source

pub const fn secure(self, secure: bool) -> Self

Creates new CookieOptions with secure

Source

pub const fn http_only(self, http_only: bool) -> Self

Creates new CookieOptions with http_only

Source

pub fn same_site(self, same_site: SameSite) -> Self

Creates new CookieOptions with same_site

Converts self into a Cookie.

§Panics

Will panic if std::time::Duration cannot be converted to cookie::ime::Duration

Trait Implementations§

Source§

impl Debug for CookieOptions

Source§

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

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

impl Default for CookieOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more