pub struct SessionStore {
pub version: u32,
pub sessions: HashMap<String, CliSession>,
pub active_key: Option<String>,
pub active_profile_name: Option<String>,
pub updated_at: DateTime<Utc>,
}Fields§
§version: u32§sessions: HashMap<String, CliSession>§active_key: Option<String>§active_profile_name: Option<String>§updated_at: DateTime<Utc>Implementations§
Source§impl SessionStore
impl SessionStore
pub fn new() -> Self
pub fn get_valid_session(&self, key: &SessionKey) -> Option<&CliSession>
pub fn get_valid_session_mut( &mut self, key: &SessionKey, ) -> Option<&mut CliSession>
pub fn get_session(&self, key: &SessionKey) -> Option<&CliSession>
pub fn upsert_session(&mut self, key: &SessionKey, session: CliSession)
pub fn remove_session(&mut self, key: &SessionKey) -> Option<CliSession>
pub fn set_active(&mut self, key: &SessionKey)
pub fn set_active_with_profile(&mut self, key: &SessionKey, profile_name: &str)
pub fn active_session_key(&self) -> Option<SessionKey>
pub fn active_session(&self) -> Option<&CliSession>
pub fn prune_expired(&mut self) -> usize
pub fn all_sessions(&self) -> Vec<(&String, &CliSession)>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn load(sessions_dir: &Path) -> Option<Self>
pub fn load_or_create(sessions_dir: &Path) -> Result<Self>
pub fn save(&self, sessions_dir: &Path) -> Result<()>
Trait Implementations§
Source§impl Clone for SessionStore
impl Clone for SessionStore
Source§fn clone(&self) -> SessionStore
fn clone(&self) -> SessionStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionStore
impl Debug for SessionStore
Source§impl Default for SessionStore
impl Default for SessionStore
Source§impl<'de> Deserialize<'de> for SessionStore
impl<'de> Deserialize<'de> for SessionStore
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionStore
impl RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnwindSafe for SessionStore
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more