Add a session accessor to the client.
This commit is contained in:
parent
71e1df7063
commit
15dd1b5b54
11
src/lib.rs
11
src/lib.rs
@ -80,6 +80,17 @@ impl Client<HttpConnector> {
|
||||
session: Mutex::new(session),
|
||||
}))
|
||||
}
|
||||
|
||||
/// Get a copy of the current `Session`, if any.
|
||||
///
|
||||
/// Useful for serializing and persisting the session to be restored later.
|
||||
pub fn session(&self) -> Option<Session> {
|
||||
self.0
|
||||
.session
|
||||
.lock()
|
||||
.expect("session mutex was poisoned")
|
||||
.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user