Struct browser_window::cookie::CookieJar
source · pub struct CookieJar { /* private fields */ }
Implementations§
source§impl CookieJar
impl CookieJar
sourcepub async fn clear(&mut self, url: &str) -> usize
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.
sourcepub async fn delete(&mut self, url: &str, name: &str) -> usize
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.
sourcepub async fn delete_all(&mut self, name: &str) -> usize
pub async fn delete_all(&mut self, name: &str) -> usize
Like delete
, but with url
set empty.
sourcepub async fn find(
&self,
url: &str,
name: &str,
include_http_only: bool
) -> Option<Cookie>
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.
sourcepub async fn find_from_all(&self, name: &str) -> Option<Cookie>
pub async fn find_from_all(&self, name: &str) -> Option<Cookie>
Finds the first cookie that has the given name
.
sourcepub fn iter<'a>(
&'a self,
url: &str,
include_http_only: bool
) -> CookieIterator<'a>
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`
}
sourcepub fn iter_all<'a>(&'a self) -> CookieIterator<'a>
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.