Trait ServerOsApi

Source
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§

Source

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<()>

Source

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.

Source

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.

Source

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

Source

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.

Source

fn tcdrain(&self, terminal_id: u32) -> Result<()>

Wait until all output written to the object referred to by fd has been transmitted.

Source

fn kill(&self, pid: Pid) -> Result<()>

Terminate the process with process ID pid. (SIGTERM)

Source

fn force_kill(&self, pid: Pid) -> Result<()>

Terminate the process with process ID pid. (SIGKILL)

Source

fn box_clone(&self) -> Box<dyn ServerOsApi>

Returns a Box pointer to this ServerOsApi struct.

Source

fn send_to_client( &self, client_id: ClientId, msg: ServerToClientMsg, ) -> Result<()>

Source

fn new_client( &mut self, client_id: ClientId, stream: LocalSocketStream, ) -> Result<IpcReceiverWithContext<ClientToServerMsg>>

Source

fn remove_client(&mut self, client_id: ClientId) -> Result<()>

Source

fn load_palette(&self) -> Palette

Source

fn get_cwd(&self, pid: Pid) -> Option<PathBuf>

Returns the current working directory for a given pid

Source

fn write_to_file(&mut self, buf: String, file: Option<String>) -> Result<()>

Writes the given buffer to a string

Source

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)>

Source

fn clear_terminal_id(&self, terminal_id: u32) -> Result<()>

Provided Methods§

Source

fn reserve_terminal_id(&self) -> Result<u32>

Source

fn get_cwds( &self, _pids: Vec<Pid>, ) -> (HashMap<Pid, PathBuf>, HashMap<Pid, Vec<String>>)

Returns the current working directory for multiple pids

Source

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

Source

fn cache_resizes(&mut self)

Source

fn apply_cached_resizes(&mut self)

Trait Implementations§

Source§

impl Clone for Box<dyn ServerOsApi>

Source§

fn clone(&self) -> Box<dyn ServerOsApi>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§