pub struct SessionStore {
pub sessions: Vec<SessionEntry>,
}Fields§
§sessions: Vec<SessionEntry>Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn load(root: Option<&str>) -> Result<Self>
pub fn load(root: Option<&str>) -> Result<Self>
Load session store from disk. Returns empty store if file doesn’t exist.
Sourcepub fn load_all() -> Result<Self>
pub fn load_all() -> Result<Self>
Load all session stores across all projects under ~/.zag/projects/.
Sourcepub fn add(&mut self, entry: SessionEntry)
pub fn add(&mut self, entry: SessionEntry)
Add a session entry.
Sourcepub fn find_by_session_id(&self, id: &str) -> Option<&SessionEntry>
pub fn find_by_session_id(&self, id: &str) -> Option<&SessionEntry>
Find a session by ID.
Sourcepub fn find_by_provider_session_id(&self, id: &str) -> Option<&SessionEntry>
pub fn find_by_provider_session_id(&self, id: &str) -> Option<&SessionEntry>
Find a session by provider-native session ID.
Sourcepub fn find_by_any_id(&self, id: &str) -> Option<&SessionEntry>
pub fn find_by_any_id(&self, id: &str) -> Option<&SessionEntry>
Find a session by either wrapper or provider-native ID.
Sourcepub fn latest(&self) -> Option<&SessionEntry>
pub fn latest(&self) -> Option<&SessionEntry>
Get the most recently created session.
Sourcepub fn set_provider_session_id(
&mut self,
session_id: &str,
provider_session_id: String,
)
pub fn set_provider_session_id( &mut self, session_id: &str, provider_session_id: String, )
Update a wrapper session with the provider-native session ID.
Sourcepub fn list(&self) -> Vec<SessionInfo>
pub fn list(&self) -> Vec<SessionInfo>
List all sessions as SessionInfo, sorted by created_at descending (newest first).
Sourcepub fn get(&self, id: &str) -> Option<SessionInfo>
pub fn get(&self, id: &str) -> Option<SessionInfo>
Get a session by any ID (wrapper or provider-native) as SessionInfo.
Sourcepub fn find_by_name(&self, name: &str) -> Option<&SessionEntry>
pub fn find_by_name(&self, name: &str) -> Option<&SessionEntry>
Find a session by exact name match. Returns the most recent if multiple match.
Sourcepub fn find_by_tag(&self, tag: &str) -> Vec<&SessionEntry>
pub fn find_by_tag(&self, tag: &str) -> Vec<&SessionEntry>
Find all sessions with a matching tag (case-insensitive).
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§fn default() -> SessionStore
fn default() -> SessionStore
Returns the “default value” for a type. Read more
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 UnsafeUnpin 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