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: Cookies> Cookies for Prefixed<J>
impl<J: Cookies> Cookies for Prefixed<J>
Source§fn get(&self, name: &str) -> Option<Cookie<'static>>
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)
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 moreSource§fn remove<C: Into<Cookie<'static>>>(&self, cookie: C)
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 moreSource§fn signed(self, key: &Key) -> SignedJar<'_, Self>where
Self: Sized,
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,
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>
fn map<F>(self, f: F) -> Map<Self, F>
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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.impl<J: Copy> Copy for Prefixed<J>
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> 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