pub struct CookieJar { /* private fields */ }
cookies
only.Expand description
Provides automatic cookie session management using an in-memory cookie store.
Cookie jars are designed to be shareable across many concurrent requests, so cloning the jar simply returns a new reference to the jar instead of doing a deep clone.
This cookie jar implementation seeks to conform to the rules for client state management as described in RFC 6265.
Domain isolation
Cookies are isolated from each other based on the domain and path they are received from. As such, most methods require you to specify a URI, since unrelated websites can have cookies with the same name without conflict.
Implementations
sourceimpl CookieJar
impl CookieJar
sourcepub fn get_by_name(&self, uri: &Uri, cookie_name: &str) -> Option<Cookie>
pub fn get_by_name(&self, uri: &Uri, cookie_name: &str) -> Option<Cookie>
Get a cookie by name for the given URI.
sourcepub fn get_for_uri(&self, uri: &Uri) -> impl IntoIterator<Item = Cookie>
pub fn get_for_uri(&self, uri: &Uri) -> impl IntoIterator<Item = Cookie>
Get a copy of all the cookies in the jar that match the given URI.
The returned collection contains a copy of all the cookies matching the URI at the time this function was called. The collection is not a “live” view into the cookie jar; concurrent changes made to the jar (cookies inserted or removed) will not be reflected in the collection.
sourcepub fn set(
&self,
cookie: Cookie,
request_uri: &Uri
) -> Result<Option<Cookie>, CookieRejectedError>
pub fn set(
&self,
cookie: Cookie,
request_uri: &Uri
) -> Result<Option<Cookie>, CookieRejectedError>
Set a cookie for the given absolute request URI.
If the cookie was set successfully, returns the cookie that previously existed for the given domain, path, and cookie name, if any.
If unsuccessful, returns a CookieRejectedError
which can be used to get back the
attempted cookie.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for CookieJar
impl Send for CookieJar
impl Sync for CookieJar
impl Unpin for CookieJar
impl UnwindSafe for CookieJar
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more