pub struct SessionManager { /* private fields */ }Expand description
Lock ordering: sessions → active_session → Session mutex
When acquiring multiple locks, always follow this order to prevent deadlocks.
Implementations§
Source§impl SessionManager
impl SessionManager
pub fn new() -> Self
pub fn with_max_sessions(max_sessions: usize) -> Self
pub fn spawn( &self, command: &str, args: &[String], cwd: Option<&str>, env: Option<&HashMap<String, String>>, session_id: Option<String>, cols: u16, rows: u16, ) -> Result<(SessionId, u32), SessionError>
pub fn get(&self, session_id: &str) -> Result<Arc<Mutex<Session>>, SessionError>
pub fn active(&self) -> Result<Arc<Mutex<Session>>, SessionError>
pub fn resolve( &self, session_id: Option<&str>, ) -> Result<Arc<Mutex<Session>>, SessionError>
pub fn set_active(&self, session_id: &str) -> Result<(), SessionError>
pub fn list(&self) -> Vec<SessionInfo>
pub fn kill(&self, session_id: &str) -> Result<(), SessionError>
pub fn session_count(&self) -> usize
pub fn active_session_id(&self) -> Option<SessionId>
Trait Implementations§
Source§impl Default for SessionManager
impl Default for SessionManager
Source§impl SessionRepository for SessionManager
impl SessionRepository for SessionManager
Source§fn spawn(
&self,
command: &str,
args: &[String],
cwd: Option<&str>,
env: Option<&HashMap<String, String>>,
session_id: Option<String>,
cols: u16,
rows: u16,
) -> Result<(SessionId, u32), SessionError>
fn spawn( &self, command: &str, args: &[String], cwd: Option<&str>, env: Option<&HashMap<String, String>>, session_id: Option<String>, cols: u16, rows: u16, ) -> Result<(SessionId, u32), SessionError>
Spawn a new session with the given parameters.
Source§fn get(&self, session_id: &str) -> Result<Arc<Mutex<Session>>, SessionError>
fn get(&self, session_id: &str) -> Result<Arc<Mutex<Session>>, SessionError>
Get a session by ID.
Source§fn resolve(
&self,
session_id: Option<&str>,
) -> Result<Arc<Mutex<Session>>, SessionError>
fn resolve( &self, session_id: Option<&str>, ) -> Result<Arc<Mutex<Session>>, SessionError>
Resolve a session by ID, falling back to active session if None.
Source§fn set_active(&self, session_id: &str) -> Result<(), SessionError>
fn set_active(&self, session_id: &str) -> Result<(), SessionError>
Set the active session.
Source§fn list(&self) -> Vec<SessionInfo>
fn list(&self) -> Vec<SessionInfo>
List all sessions.
Source§fn session_count(&self) -> usize
fn session_count(&self) -> usize
Get the count of sessions.
Source§fn active_session_id(&self) -> Option<SessionId>
fn active_session_id(&self) -> Option<SessionId>
Get the active session ID.
Auto 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.