Skip to main content

Prefixed

Struct Prefixed 

Source
pub struct Prefixed<J> { /* private fields */ }
Expand description

A Cookies adapter that scopes cookies to a name Prefix.

On write it prepends the prefix and applies the prefix’s required attributes; on read it looks the cookie up under its prefixed name and strips the prefix from the result. Created by Cookies::override_prefix_host and the related combinators.

Trait Implementations§

Source§

impl<J: Clone> Clone for Prefixed<J>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<J: Cookies> Cookies for Prefixed<J>

Source§

fn get(&self, name: &str) -> Option<Cookie<'static>>

Returns the cookie named name, or None if it is absent (or, for signed/encrypted jars, fails to verify).
Source§

fn add<C: Into<Cookie<'static>>>(&self, cookie: C)

Adds cookie. It is serialized into a Set-Cookie response header once the cookie router layer handles the response. Read more
Source§

fn remove<C: Into<Cookie<'static>>>(&self, cookie: C)

Removes cookie. If the request carried an original cookie with the same name, an expiring removal cookie is sent. Pass the same Path/ Domain the cookie was set with. Read more
Source§

fn signed(self, key: &Key) -> SignedJar<'_, Self>
where Self: Sized,

Wraps this jar so signed cookies are written and verified with key.
Source§

fn private(self, key: &Key) -> PrivateJar<'_, Self>
where Self: Sized,

Wraps this jar so cookies are encrypted and decrypted with key.
Source§

fn map<F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: Fn(&mut Cookie<'static>),

Wraps this jar so every added cookie is passed through f before being stored. Use this for custom attribute changes.
Source§

fn override_prefix_host(self) -> Prefixed<Self>
where Self: Sized,

Forces the __Host- prefix and its required attributes (Secure, Path=/, no Domain) on every added cookie.
Source§

fn default_prefix_host(self) -> Prefixed<Self>
where Self: Sized,

Applies the __Host- prefix, filling its required attributes only when the cookie does not already set them.
Source§

fn override_prefix_secure(self) -> Prefixed<Self>
where Self: Sized,

Forces the __Secure- prefix and its required Secure attribute on every added cookie.
Source§

fn default_prefix_secure(self) -> Prefixed<Self>
where Self: Sized,

Applies the __Secure- prefix, setting Secure only when the cookie does not already set it.
Source§

fn override_secure( self, value: bool, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Secure on every added cookie, overriding any existing value.
Source§

fn default_secure(self, value: bool) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Secure on added cookies that do not already specify it.
Source§

fn override_http_only( self, value: bool, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets HttpOnly on every added cookie, overriding any existing value.
Source§

fn default_http_only( self, value: bool, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets HttpOnly on added cookies that do not already specify it.
Source§

fn override_same_site( self, value: SameSite, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets SameSite on every added cookie, overriding any existing value.
Source§

fn default_same_site( self, value: SameSite, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets SameSite on added cookies that do not already specify it.
Source§

fn override_path( self, value: impl Into<String>, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Path on every added cookie, overriding any existing value.
Source§

fn default_path( self, value: impl Into<String>, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Path on added cookies that do not already specify it.
Source§

fn override_domain( self, value: impl Into<String>, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Domain on every added cookie, overriding any existing value.
Source§

fn default_domain( self, value: impl Into<String>, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Domain on added cookies that do not already specify it.
Source§

fn override_max_age( self, value: Duration, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Max-Age on every added cookie, overriding any existing value.
Source§

fn default_max_age( self, value: Duration, ) -> Map<Self, impl Fn(&mut Cookie<'static>)>
where Self: Sized,

Sets Max-Age on added cookies that do not already specify it.
Source§

impl<J: Copy> Copy for Prefixed<J>

Source§

impl<J: Debug> Debug for Prefixed<J>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<J> Freeze for Prefixed<J>
where J: Freeze,

§

impl<J> RefUnwindSafe for Prefixed<J>
where J: RefUnwindSafe,

§

impl<J> Send for Prefixed<J>
where J: Send,

§

impl<J> Sync for Prefixed<J>
where J: Sync,

§

impl<J> Unpin for Prefixed<J>
where J: Unpin,

§

impl<J> UnsafeUnpin for Prefixed<J>
where J: UnsafeUnpin,

§

impl<J> UnwindSafe for Prefixed<J>
where J: UnwindSafe,

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> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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