pub struct SessionIndex { /* private fields */ }Expand description
Index of all stored sessions.
Implementations§
Source§impl SessionIndex
impl SessionIndex
Sourcepub fn add(&mut self, meta: SessionMeta)
pub fn add(&mut self, meta: SessionMeta)
Add a session to the index.
Sourcepub fn remove(&mut self, session_id: &str) -> Option<SessionMeta>
pub fn remove(&mut self, session_id: &str) -> Option<SessionMeta>
Remove a session from the index.
Sourcepub fn get(&self, session_id: &str) -> Option<&SessionMeta>
pub fn get(&self, session_id: &str) -> Option<&SessionMeta>
Get a session by ID.
Sourcepub fn list(&self) -> Vec<&SessionMeta>
pub fn list(&self) -> Vec<&SessionMeta>
List all sessions, sorted by start time (newest first).
Sourcepub fn by_project(&self, project_path: &Path) -> Vec<&SessionMeta>
pub fn by_project(&self, project_path: &Path) -> Vec<&SessionMeta>
Get sessions for a specific project.
Sourcepub fn latest(&self) -> Option<&SessionMeta>
pub fn latest(&self) -> Option<&SessionMeta>
Get the most recent session.
Sourcepub fn latest_for_project(&self, project_path: &Path) -> Option<&SessionMeta>
pub fn latest_for_project(&self, project_path: &Path) -> Option<&SessionMeta>
Get the most recent session for a project.
Sourcepub fn count_for_project(&self, project_path: &Path) -> usize
pub fn count_for_project(&self, project_path: &Path) -> usize
Count sessions for a project.
Sourcepub fn cleanup(&mut self, keep_per_project: usize) -> Vec<String>
pub fn cleanup(&mut self, keep_per_project: usize) -> Vec<String>
Cleanup old sessions, keeping only the N most recent per project.
Returns the list of session IDs that were removed.
Sourcepub fn rebuild_project_index(&mut self)
pub fn rebuild_project_index(&mut self)
Rebuild the by_project index (call after deserialization).
Search sessions by tags.
Sourcepub fn by_name_contains(&self, pattern: &str) -> Vec<&SessionMeta>
pub fn by_name_contains(&self, pattern: &str) -> Vec<&SessionMeta>
Search sessions by name pattern.
Trait Implementations§
Source§impl Clone for SessionIndex
impl Clone for SessionIndex
Source§fn clone(&self) -> SessionIndex
fn clone(&self) -> SessionIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SessionIndex
impl Debug for SessionIndex
Source§impl Default for SessionIndex
impl Default for SessionIndex
Source§fn default() -> SessionIndex
fn default() -> SessionIndex
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SessionIndex
impl<'de> Deserialize<'de> for SessionIndex
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 SessionIndex
impl RefUnwindSafe for SessionIndex
impl Send for SessionIndex
impl Sync for SessionIndex
impl Unpin for SessionIndex
impl UnsafeUnpin for SessionIndex
impl UnwindSafe for SessionIndex
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> 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