pub struct CookieManager { /* private fields */ }
Expand description
Manages cookies using a thread-safe CookieJar
.
This struct provides methods to add, remove, and retrieve cookies,
as well as generate Set-Cookie
headers for HTTP responses.
Implementations§
Source§impl CookieManager
impl CookieManager
Sourcepub fn new(jar: CookieJar<'static>) -> Self
pub fn new(jar: CookieJar<'static>) -> Self
Creates a new instance of CookieManager
with the specified cookie jar.
§Arguments
jar
- The initial cookie jar to manage cookies.
Sourcepub fn set<C: Into<Cookie<'static>>>(&self, cookie: C)
pub fn set<C: Into<Cookie<'static>>>(&self, cookie: C)
Adds a cookie to the jar.
§Arguments
cookie
- The cookie to add to the jar.
alias for
CookieManager::add
Returns all cookies in the jar as a set.
§Returns
BTreeSet<Cookie<'static>>
- A set of all cookies currently in the jar.
Sourcepub fn as_header_value(&self) -> Vec<String>
pub fn as_header_value(&self) -> Vec<String>
Generates Set-Cookie
header value for all cookies in the jar.
§Returns
Vec<String>
- A vector ofSet-Cookie
header string value.
Trait Implementations§
Source§impl Clone for CookieManager
impl Clone for CookieManager
Source§fn clone(&self) -> CookieManager
fn clone(&self) -> CookieManager
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<S> FromRequestParts<S> for CookieManager
impl<S> FromRequestParts<S> for CookieManager
Source§type Rejection = (StatusCode, String)
type Rejection = (StatusCode, String)
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Auto Trait Implementations§
impl Freeze for CookieManager
impl RefUnwindSafe for CookieManager
impl Send for CookieManager
impl Sync for CookieManager
impl Unpin for CookieManager
impl UnwindSafe for CookieManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§async fn from_request(
req: Request<Body>,
state: &S,
) -> Result<T, <T as FromRequest<S, ViaParts>>::Rejection>
async fn from_request( req: Request<Body>, state: &S, ) -> Result<T, <T as FromRequest<S, ViaParts>>::Rejection>
Perform the extraction.