pub struct CookieJar { /* private fields */ }

Implementations§

source§

impl CookieJar

source

pub async fn clear(&mut self, url: &str) -> usize

Deletes all cookies. If url is not an empty string, only the cookies of the given url will be deleted.

source

pub async fn clear_all(&mut self) -> usize

Like clear, but with url set empty.

source

pub async fn delete(&mut self, url: &str, name: &str) -> usize

Deletes all cookies with the given name. If url is not empty, only the cookie with the given name at that url will be deleted. If name is empty, all cookies at the given url will be deleted. If both url and name are empty, all cookies will be deleted.

source

pub async fn delete_all(&mut self, name: &str) -> usize

Like delete, but with url set empty.

source

pub async fn find( &self, url: &str, name: &str, include_http_only: bool ) -> Option<Cookie>

Finds the first cookie that has the given name in the given url. If include_http_only is set to false, a HttpOnly cookie will not be found.

source

pub async fn find_from_all(&self, name: &str) -> Option<Cookie>

Finds the first cookie that has the given name.

source

pub fn iter<'a>( &'a self, url: &str, include_http_only: bool ) -> CookieIterator<'a>

Returns a CookieIterator that iterates over cookies asynchronously. The CookieIterator has an async next function that you can use.

§Example
let cookie_jar = app.cookie_jar();
let mut iterator = cookie_jar.iter("http://localhost/", true);
 
while let Some(cookie) = iterator.next().await {
	// ... do something with `cookie`
}
source

pub fn iter_all<'a>(&'a self) -> CookieIterator<'a>

Returns a CookieIterator that iterators over cookies asynchronously. Like iter, but iterates over all cookies from any url.

source

pub async fn store( &mut self, url: &str, cookie: &Cookie ) -> Result<(), CookieStorageError>

Stores the given cookie for the given url.

Trait Implementations§

source§

impl Drop for CookieJar

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.