pub struct SessionManager { /* private fields */ }Expand description
Manages session lifecycle and switching
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn create_session(
&mut self,
name: String,
context: SessionContext,
) -> SessionResult<Session>
pub fn create_session( &mut self, name: String, context: SessionContext, ) -> SessionResult<Session>
Create a new session
Sourcepub fn delete_session(&mut self, session_id: &str) -> SessionResult<()>
pub fn delete_session(&mut self, session_id: &str) -> SessionResult<()>
Delete a session
Sourcepub fn get_session(&self, session_id: &str) -> SessionResult<Session>
pub fn get_session(&self, session_id: &str) -> SessionResult<Session>
Get a session by ID
Sourcepub fn get_active_session(&self) -> SessionResult<Session>
pub fn get_active_session(&self) -> SessionResult<Session>
Get the active session
Sourcepub fn switch_session(&mut self, session_id: &str) -> SessionResult<Session>
pub fn switch_session(&mut self, session_id: &str) -> SessionResult<Session>
Switch to a different session
Sourcepub fn list_sessions(&self) -> Vec<Session>
pub fn list_sessions(&self) -> Vec<Session>
List all sessions
Sourcepub fn active_session_id(&self) -> Option<&str>
pub fn active_session_id(&self) -> Option<&str>
Get the ID of the active session
Sourcepub fn update_session(&mut self, session: Session) -> SessionResult<()>
pub fn update_session(&mut self, session: Session) -> SessionResult<()>
Update a session
Sourcepub fn session_limit(&self) -> usize
pub fn session_limit(&self) -> usize
Get the session limit
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get the number of active sessions
Sourcepub fn is_limit_reached(&self) -> bool
pub fn is_limit_reached(&self) -> bool
Check if session limit is reached
Trait Implementations§
Source§impl Clone for SessionManager
impl Clone for SessionManager
Source§fn clone(&self) -> SessionManager
fn clone(&self) -> SessionManager
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 moreAuto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin 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