pub struct CookieJar<'a>(/* private fields */);Expand description
Collection of cookies.
The jar is accessed using Agent::cookie_jar_lock.
It can be saved and loaded.
Implementations§
source§impl<'a> CookieJar<'a>
impl<'a> CookieJar<'a>
sourcepub fn get(&self, domain: &str, path: &str, name: &str) -> Option<Cookie<'_>>
pub fn get(&self, domain: &str, path: &str, name: &str) -> Option<Cookie<'_>>
Returns a reference to the unexpired Cookie corresponding to the specified domain,
path, and name.
sourcepub fn remove(
&mut self,
domain: &str,
path: &str,
name: &str,
) -> Option<Cookie<'static>>
pub fn remove( &mut self, domain: &str, path: &str, name: &str, ) -> Option<Cookie<'static>>
Removes a Cookie from the jar, returning the Cookie if it was in the jar
sourcepub fn insert(
&mut self,
cookie: Cookie<'static>,
uri: &Uri,
) -> Result<(), Error>
pub fn insert( &mut self, cookie: Cookie<'static>, uri: &Uri, ) -> Result<(), Error>
Inserts cookie, received from uri, into the jar, following the rules of the
IETF RFC6265 Storage Model.
sourcepub fn iter(&self) -> impl Iterator<Item = Cookie<'_>>
pub fn iter(&self) -> impl Iterator<Item = Cookie<'_>>
An iterator visiting all the unexpired cookies in the jar
sourcepub fn save_json<W: Write>(&self, writer: &mut W) -> Result<(), Error>
pub fn save_json<W: Write>(&self, writer: &mut W) -> Result<(), Error>
Serialize any unexpired and persistent cookies in the jar to JSON format and
write them to writer
Auto Trait Implementations§
impl<'a> Freeze for CookieJar<'a>
impl<'a> RefUnwindSafe for CookieJar<'a>
impl<'a> !Send for CookieJar<'a>
impl<'a> Sync for CookieJar<'a>
impl<'a> Unpin for CookieJar<'a>
impl<'a> UnwindSafe for CookieJar<'a>
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