[go: up one dir, main page]

ureq

Struct CookieJar

Source
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>

Source

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.

Source

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

Source

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.

Source

pub fn clear(&mut self)

Clear the contents of the jar

Source

pub fn iter(&self) -> impl Iterator<Item = Cookie<'_>>

An iterator visiting all the unexpired cookies in the jar

Source

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

Source

pub fn load_json<R: BufRead>(&mut self, reader: R) -> Result<(), Error>

Load JSON-formatted cookies from reader, skipping any expired cookies

Replaces all the contents of the current cookie jar.

Source

pub fn release(self)

Release the cookie jar.

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> 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>,

Source§

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>,

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T