pub trait ServerOsApi: Send + Sync {
Show 22 methods
// Required methods
fn set_terminal_size_using_terminal_id(
&self,
id: u32,
cols: u16,
rows: u16,
width_in_pixels: Option<u16>,
height_in_pixels: Option<u16>,
) -> Result<()>;
fn spawn_terminal(
&self,
terminal_action: TerminalAction,
quit_cb: Box<dyn Fn(PaneId, Option<i32>, RunCommand) + Send>,
default_editor: Option<PathBuf>,
) -> Result<(u32, RawFd, RawFd)>;
fn read_from_tty_stdout(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize>;
fn async_file_reader(&self, fd: RawFd) -> Box<dyn AsyncReader>;
fn write_to_tty_stdin(&self, terminal_id: u32, buf: &[u8]) -> Result<usize>;
fn tcdrain(&self, terminal_id: u32) -> Result<()>;
fn kill(&self, pid: Pid) -> Result<()>;
fn force_kill(&self, pid: Pid) -> Result<()>;
fn box_clone(&self) -> Box<dyn ServerOsApi>;
fn send_to_client(
&self,
client_id: ClientId,
msg: ServerToClientMsg,
) -> Result<()>;
fn new_client(
&mut self,
client_id: ClientId,
stream: LocalSocketStream,
) -> Result<IpcReceiverWithContext<ClientToServerMsg>>;
fn remove_client(&mut self, client_id: ClientId) -> Result<()>;
fn load_palette(&self) -> Palette;
fn get_cwd(&self, pid: Pid) -> Option<PathBuf>;
fn write_to_file(&mut self, buf: String, file: Option<String>) -> Result<()>;
fn re_run_command_in_terminal(
&self,
terminal_id: u32,
run_command: RunCommand,
quit_cb: Box<dyn Fn(PaneId, Option<i32>, RunCommand) + Send>,
) -> Result<(RawFd, RawFd)>;
fn clear_terminal_id(&self, terminal_id: u32) -> Result<()>;
// Provided methods
fn reserve_terminal_id(&self) -> Result<u32> { ... }
fn get_cwds(
&self,
_pids: Vec<Pid>,
) -> (HashMap<Pid, PathBuf>, HashMap<Pid, Vec<String>>) { ... }
fn get_all_cmds_by_ppid(
&self,
_post_hook: &Option<String>,
) -> HashMap<String, Vec<String>> { ... }
fn cache_resizes(&mut self) { ... }
fn apply_cached_resizes(&mut self) { ... }
}Expand description
The ServerOsApi trait represents an abstract interface to the features of an operating system that
Zellij server requires.
Required Methods§
fn set_terminal_size_using_terminal_id( &self, id: u32, cols: u16, rows: u16, width_in_pixels: Option<u16>, height_in_pixels: Option<u16>, ) -> Result<()>
Sourcefn spawn_terminal(
&self,
terminal_action: TerminalAction,
quit_cb: Box<dyn Fn(PaneId, Option<i32>, RunCommand) + Send>,
default_editor: Option<PathBuf>,
) -> Result<(u32, RawFd, RawFd)>
fn spawn_terminal( &self, terminal_action: TerminalAction, quit_cb: Box<dyn Fn(PaneId, Option<i32>, RunCommand) + Send>, default_editor: Option<PathBuf>, ) -> Result<(u32, RawFd, RawFd)>
Spawn a new terminal, with a terminal action. The returned tuple contains the master file descriptor of the forked pseudo terminal and a ChildId struct containing process id’s for the forked child process.
Sourcefn read_from_tty_stdout(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize>
fn read_from_tty_stdout(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize>
Read bytes from the standard output of the virtual terminal referred to by fd.
Sourcefn async_file_reader(&self, fd: RawFd) -> Box<dyn AsyncReader>
fn async_file_reader(&self, fd: RawFd) -> Box<dyn AsyncReader>
Creates an AsyncReader that can be used to read from fd in an async context
Sourcefn write_to_tty_stdin(&self, terminal_id: u32, buf: &[u8]) -> Result<usize>
fn write_to_tty_stdin(&self, terminal_id: u32, buf: &[u8]) -> Result<usize>
Write bytes to the standard input of the virtual terminal referred to by fd.
Sourcefn tcdrain(&self, terminal_id: u32) -> Result<()>
fn tcdrain(&self, terminal_id: u32) -> Result<()>
Wait until all output written to the object referred to by fd has been transmitted.
Sourcefn force_kill(&self, pid: Pid) -> Result<()>
fn force_kill(&self, pid: Pid) -> Result<()>
Terminate the process with process ID pid. (SIGKILL)
Sourcefn box_clone(&self) -> Box<dyn ServerOsApi>
fn box_clone(&self) -> Box<dyn ServerOsApi>
Returns a Box pointer to this ServerOsApi struct.
fn send_to_client( &self, client_id: ClientId, msg: ServerToClientMsg, ) -> Result<()>
fn new_client( &mut self, client_id: ClientId, stream: LocalSocketStream, ) -> Result<IpcReceiverWithContext<ClientToServerMsg>>
fn remove_client(&mut self, client_id: ClientId) -> Result<()>
fn load_palette(&self) -> Palette
Sourcefn get_cwd(&self, pid: Pid) -> Option<PathBuf>
fn get_cwd(&self, pid: Pid) -> Option<PathBuf>
Returns the current working directory for a given pid
Sourcefn write_to_file(&mut self, buf: String, file: Option<String>) -> Result<()>
fn write_to_file(&mut self, buf: String, file: Option<String>) -> Result<()>
Writes the given buffer to a string
fn re_run_command_in_terminal( &self, terminal_id: u32, run_command: RunCommand, quit_cb: Box<dyn Fn(PaneId, Option<i32>, RunCommand) + Send>, ) -> Result<(RawFd, RawFd)>
fn clear_terminal_id(&self, terminal_id: u32) -> Result<()>
Provided Methods§
fn reserve_terminal_id(&self) -> Result<u32>
Sourcefn get_cwds(
&self,
_pids: Vec<Pid>,
) -> (HashMap<Pid, PathBuf>, HashMap<Pid, Vec<String>>)
fn get_cwds( &self, _pids: Vec<Pid>, ) -> (HashMap<Pid, PathBuf>, HashMap<Pid, Vec<String>>)
Returns the current working directory for multiple pids
Sourcefn get_all_cmds_by_ppid(
&self,
_post_hook: &Option<String>,
) -> HashMap<String, Vec<String>>
fn get_all_cmds_by_ppid( &self, _post_hook: &Option<String>, ) -> HashMap<String, Vec<String>>
Get a list of all running commands by their parent process id
fn cache_resizes(&mut self)
fn apply_cached_resizes(&mut self)
Trait Implementations§
Source§impl Clone for Box<dyn ServerOsApi>
impl Clone for Box<dyn ServerOsApi>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more