#[non_exhaustive]pub struct Session { /* private fields */ }Expand description
A logged-in session. Persist it (securely) to skip the ~3.5 s login on the next run; the client refreshes it automatically.
Get one from Client::session or
Client::login, and restore it with
Client::with_session. It serializes the
access and refresh tokens in plain text, so store it with restricted
permissions. Its Debug output redacts the tokens.
The serialized form carries a format version. A
session saved by a newer release may have a version this release does
not know (Session::is_supported is false); discard it and log in
again rather than using it.
Implementations§
Source§impl Session
impl Session
Sourcepub const FORMAT_VERSION: u32 = 1
pub const FORMAT_VERSION: u32 = 1
The serialized format version written by this release.
Sourcepub fn expires_at(&self) -> Timestamp
pub fn expires_at(&self) -> Timestamp
When the access token expires. The client refreshes the session shortly before this, using the refresh token.
Sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Whether this release understands the session’s format version
(Session::FORMAT_VERSION).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Session
impl StructuralPartialEq for Session
Auto Trait Implementations§
impl Forget for Session
impl Freeze for Session
impl Move for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.