Struct user_agent::Session
source · pub struct Session<C: SessionClient> {
pub client: C,
pub store: CookieStore,
}
Fields
client: C
store: CookieStore
Implementations
sourceimpl<C: SessionClient> Session<C>
impl<C: SessionClient> Session<C>
pub fn new(client: C) -> Self
pub fn load<R, E, F>(
client: C,
reader: R,
cookie_from_str: F
) -> Result<Session<C>, Error>where
R: BufRead,
F: Fn(&str) -> Result<Cookie<'static>, E>,
Error: From<E>,
pub fn load_json<R: BufRead>(client: C, reader: R) -> Result<Session<C>, Error>
pub fn save<W, E, F>(
&self,
writer: &mut W,
cookie_to_string: F
) -> Result<(), Error>where
W: Write,
F: Fn(&Cookie<'_>) -> Result<String, E>,
Error: From<E>,
pub fn save_json<W: Write>(&self, writer: &mut W) -> Result<(), Error>
pub fn get_with<U, P>(
&mut self,
url: U,
prepare_and_send: P
) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>where
P: FnOnce(<C as SessionClient>::Request) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>,
U: IntoUrl,
pub fn put_with<U, P>(
&mut self,
url: U,
prepare_and_send: P
) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>where
P: FnOnce(<C as SessionClient>::Request) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>,
U: IntoUrl,
pub fn head_with<U, P>(
&mut self,
url: U,
prepare_and_send: P
) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>where
P: FnOnce(<C as SessionClient>::Request) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>,
U: IntoUrl,
pub fn delete_with<U, P>(
&mut self,
url: U,
prepare_and_send: P
) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>where
P: FnOnce(<C as SessionClient>::Request) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>,
U: IntoUrl,
pub fn post_with<U, P>(
&mut self,
url: U,
prepare_and_send: P
) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>where
P: FnOnce(<C as SessionClient>::Request) -> Result<<C as SessionClient>::Response, <C as SessionClient>::SendError>,
U: IntoUrl,
Auto Trait Implementations
impl<C> RefUnwindSafe for Session<C>where
C: RefUnwindSafe,
impl<C> Send for Session<C>where
C: Send,
impl<C> Sync for Session<C>where
C: Sync,
impl<C> Unpin for Session<C>where
C: Unpin,
impl<C> UnwindSafe for Session<C>where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more