pub struct Session {
pub id: String,
pub name: Option<String>,
pub pid: i32,
pub created_at: DateTime<Utc>,
pub attached: bool,
pub socket_path: PathBuf,
pub shell: String,
pub working_dir: String,
}Fields§
§id: String§name: Option<String>§pid: i32§created_at: DateTime<Utc>§attached: bool§socket_path: PathBuf§shell: String§working_dir: StringImplementations§
Source§impl Session
impl Session
pub fn new(id: String, pid: i32, socket_path: PathBuf) -> Self
pub fn with_name( id: String, name: Option<String>, pid: i32, socket_path: PathBuf, ) -> Self
pub fn display_name(&self) -> String
pub fn session_dir() -> Result<PathBuf>
pub fn socket_dir() -> Result<PathBuf>
pub fn metadata_path(&self) -> Result<PathBuf>
pub fn save(&self) -> Result<()>
pub fn load(id: &str) -> Result<Self>
pub fn list_all() -> Result<Vec<Session>>
pub fn cleanup(id: &str) -> Result<()>
pub fn is_process_alive(pid: i32) -> bool
pub fn mark_attached(&mut self) -> Result<()>
pub fn mark_detached(&mut self) -> Result<()>
pub fn connect_socket(&self) -> Result<UnixStream>
pub fn get_client_count(&self) -> usize
pub fn update_client_count(session_id: &str, count: usize) -> Result<()>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
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 Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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