pub struct SessionManager { /* private fields */ }Expand description
Manages conversation sessions
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn get_or_create(&mut self, key: impl Into<String>) -> &mut Session
pub fn get_or_create(&mut self, key: impl Into<String>) -> &mut Session
Get or create a session
Sourcepub fn get_or_load(&mut self, key: &str) -> Option<&Session>
pub fn get_or_load(&mut self, key: &str) -> Option<&Session>
Get a session if it exists (cache or disk). Does not create.
Sourcepub fn archive_and_reset(&mut self, key: &str) -> Result<bool>
pub fn archive_and_reset(&mut self, key: &str) -> Result<bool>
Archive an existing session and clear it from memory, forcing a fresh start
Sourcepub fn list_sessions(&self) -> Vec<SessionInfo>
pub fn list_sessions(&self) -> Vec<SessionInfo>
List all sessions
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
impl UnwindSafe for SessionManager
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