logo
pub struct CookieJar { /* private fields */ }
Available on crate feature 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

Create a new, empty cookie jar.

Get a cookie by name for the given URI.

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.

Remove all cookies from this cookie jar.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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

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

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