[−][src]Struct surf_cookie_middleware::CookieStore
Implementations
impl CookieStore
[src]
pub fn get_request_cookies(
&self,
url: &Url
) -> impl Iterator<Item = &Cookie<'static>>
[src]
&self,
url: &Url
) -> impl Iterator<Item = &Cookie<'static>>
Return an Iterator
of the cookies for url
in the store
pub fn store_response_cookies<I>(&mut self, cookies: I, url: &Url) where
I: Iterator<Item = Cookie<'static>>,
[src]
I: Iterator<Item = Cookie<'static>>,
Store the cookies
received from url
pub fn with_suffix_list(self, psl: List) -> CookieStore
[src]
Specify a publicsuffix::List
for the CookieStore
to allow public suffix
matching
pub fn contains(&self, domain: &str, path: &str, name: &str) -> bool
[src]
Returns true if the CookieStore
contains an unexpired Cookie
corresponding to the
specified domain
, path
, and name
.
pub fn contains_any(&self, domain: &str, path: &str, name: &str) -> bool
[src]
Returns true if the CookieStore
contains any (even an expired) Cookie
corresponding
to the specified domain
, path
, and name
.
pub fn get(&self, domain: &str, path: &str, name: &str) -> Option<&Cookie<'_>>
[src]
Returns a reference to the unexpired Cookie
corresponding to the specified domain
,
path
, and name
.
pub fn get_any(
&self,
domain: &str,
path: &str,
name: &str
) -> Option<&Cookie<'static>>
[src]
&self,
domain: &str,
path: &str,
name: &str
) -> Option<&Cookie<'static>>
Returns a reference to the (possibly expired) Cookie
corresponding to the specified
domain
, path
, and name
.
pub fn remove(
&mut self,
domain: &str,
path: &str,
name: &str
) -> Option<Cookie<'static>>
[src]
&mut self,
domain: &str,
path: &str,
name: &str
) -> Option<Cookie<'static>>
Removes a Cookie
from the store, returning the Cookie
if it was in the store
pub fn matches(&self, request_url: &Url) -> Vec<&Cookie<'static>>
[src]
Returns a collection of references to unexpired cookies that path- and domain-match
request_url
, as well as having HttpOnly and Secure attributes compatible with the
request_url
.
pub fn parse(
&mut self,
cookie_str: &str,
request_url: &Url
) -> Result<StoreAction, Error>
[src]
&mut self,
cookie_str: &str,
request_url: &Url
) -> Result<StoreAction, Error>
Parses a new Cookie
from cookie_str
and inserts it into the store.
pub fn insert_raw(
&mut self,
cookie: &Cookie<'_>,
request_url: &Url
) -> Result<StoreAction, Error>
[src]
&mut self,
cookie: &Cookie<'_>,
request_url: &Url
) -> Result<StoreAction, Error>
Converts a cookie::Cookie
(from the cookie
crate) into a cookie_store::Cookie
and
inserts it into the store.
pub fn insert(
&mut self,
cookie: Cookie<'static>,
request_url: &Url
) -> Result<StoreAction, Error>
[src]
&mut self,
cookie: Cookie<'static>,
request_url: &Url
) -> Result<StoreAction, Error>
Inserts cookie
, received from request_url
, into the store, following the rules of the
IETF RFC6265 Storage Model. If the
Cookie
is unexpired and is successfully inserted, returns
Ok(StoreAction::Inserted)
. If the Cookie
is expired and matches an existing
Cookie
in the store, the existing Cookie
wil be expired()
and
Ok(StoreAction::ExpiredExisting)
will be returned.
pub fn clear(&mut self)
[src]
Clear the contents of the store
pub fn iter_unexpired(
&'a self
) -> impl Iterator<Item = &'a Cookie<'static>> + 'a
[src]
&'a self
) -> impl Iterator<Item = &'a Cookie<'static>> + 'a
An iterator visiting all the unexpired cookies in the store
pub fn iter_any(&'a self) -> impl Iterator<Item = &'a Cookie<'static>> + 'a
[src]
An iterator visiting all (including expired) cookies in the store
pub fn save<W, E, F>(
&self,
writer: &mut W,
cookie_to_string: F
) -> Result<(), Box<dyn Error + 'static + Sync + Send>> where
F: Fn(&Cookie<'static>) -> Result<String, E>,
W: Write,
Box<dyn Error + 'static + Sync + Send>: From<E>,
[src]
&self,
writer: &mut W,
cookie_to_string: F
) -> Result<(), Box<dyn Error + 'static + Sync + Send>> where
F: Fn(&Cookie<'static>) -> Result<String, E>,
W: Write,
Box<dyn Error + 'static + Sync + Send>: From<E>,
Serialize any unexpired and persistent cookies in the store with cookie_to_string
and write them to writer
pub fn save_json<W>(
&self,
writer: &mut W
) -> Result<(), Box<dyn Error + 'static + Sync + Send>> where
W: Write,
[src]
&self,
writer: &mut W
) -> Result<(), Box<dyn Error + 'static + Sync + Send>> where
W: Write,
Serialize any unexpired and persistent cookies in the store to JSON format and
write them to writer
pub fn load<R, E, F>(
reader: R,
cookie_from_str: F
) -> Result<CookieStore, Box<dyn Error + 'static + Sync + Send>> where
F: Fn(&str) -> Result<Cookie<'static>, E>,
R: BufRead,
Box<dyn Error + 'static + Sync + Send>: From<E>,
[src]
reader: R,
cookie_from_str: F
) -> Result<CookieStore, Box<dyn Error + 'static + Sync + Send>> where
F: Fn(&str) -> Result<Cookie<'static>, E>,
R: BufRead,
Box<dyn Error + 'static + Sync + Send>: From<E>,
Load cookies from reader
, deserializing with cookie_from_str
, skipping any expired
cookies
pub fn load_json<R>(
reader: R
) -> Result<CookieStore, Box<dyn Error + 'static + Sync + Send>> where
R: BufRead,
[src]
reader: R
) -> Result<CookieStore, Box<dyn Error + 'static + Sync + Send>> where
R: BufRead,
Load JSON-formatted cookies from reader
, skipping any expired cookies
Trait Implementations
impl Debug for CookieStore
[src]
impl Default for CookieStore
[src]
pub fn default() -> CookieStore
[src]
impl<'de> Deserialize<'de> for CookieStore
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<CookieStore, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<CookieStore, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Serialize for CookieStore
[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Auto Trait Implementations
impl RefUnwindSafe for CookieStore
impl Send for CookieStore
impl Sync for CookieStore
impl Unpin for CookieStore
impl UnwindSafe for CookieStore
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,