Trait portable_pty::MasterPty
source · pub trait MasterPty {
// Required methods
fn resize(&self, size: PtySize) -> Result<(), Error>;
fn get_size(&self) -> Result<PtySize, Error>;
fn try_clone_reader(&self) -> Result<Box<dyn Read + Send>, Error>;
fn take_writer(&self) -> Result<Box<dyn Write + Send>, Error>;
fn process_group_leader(&self) -> Option<pid_t>;
fn as_raw_fd(&self) -> Option<RawFd>;
// Provided method
fn get_termios(&self) -> Option<Termios> { ... }
}
Expand description
Represents the master/control end of the pty
Required Methods§
sourcefn resize(&self, size: PtySize) -> Result<(), Error>
fn resize(&self, size: PtySize) -> Result<(), Error>
Inform the kernel and thus the child process that the window resized. It will update the winsize information maintained by the kernel, and generate a signal for the child to notice and update its state.
sourcefn get_size(&self) -> Result<PtySize, Error>
fn get_size(&self) -> Result<PtySize, Error>
Retrieves the size of the pty as known by the kernel
sourcefn try_clone_reader(&self) -> Result<Box<dyn Read + Send>, Error>
fn try_clone_reader(&self) -> Result<Box<dyn Read + Send>, Error>
Obtain a readable handle; output from the slave(s) is readable via this stream.
sourcefn take_writer(&self) -> Result<Box<dyn Write + Send>, Error>
fn take_writer(&self) -> Result<Box<dyn Write + Send>, Error>
Obtain a writable handle; writing to it will send data to the slave end. Dropping the writer will send EOF to the slave end. It is invalid to take the writer more than once.
sourcefn process_group_leader(&self) -> Option<pid_t>
fn process_group_leader(&self) -> Option<pid_t>
If applicable to the type of the tty, return the local process id of the process group or session leader
sourcefn as_raw_fd(&self) -> Option<RawFd>
fn as_raw_fd(&self) -> Option<RawFd>
If get_termios() and process_group_leader() are both implemented and return Some, then as_raw_fd() should return the same underlying fd associated with the stream. This is to enable applications that “know things” to query similar information for themselves.
Provided Methods§
sourcefn get_termios(&self) -> Option<Termios>
fn get_termios(&self) -> Option<Termios>
If applicable to the type of the tty, return the termios associated with the stream