pub unsafe trait Terminal {
    // Required method
    fn tty_fd(&self) -> RawFd;
    // Provided methods
    fn set_canon_mode(&self) -> Result<()> { ... }
    fn set_raw_mode(&self) -> Result<()> { ... }
    fn set_non_block(&self, non_block: bool) -> Result<()> { ... }
}Expand description
Trait for file descriptors that are TTYs, according to isatty(3).
§Safety
This is marked unsafe because the implementation must promise that the returned RawFd is a valid fd and that the lifetime of the returned fd is at least that of the trait object.
Required Methods§
Provided Methods§
sourcefn set_canon_mode(&self) -> Result<()>
 
fn set_canon_mode(&self) -> Result<()>
Set this terminal’s mode to canonical mode (ICANON | ECHO | ISIG).
sourcefn set_raw_mode(&self) -> Result<()>
 
fn set_raw_mode(&self) -> Result<()>
Set this terminal’s mode to raw mode (!(ICANON | ECHO | ISIG)).
sourcefn set_non_block(&self, non_block: bool) -> Result<()>
 
fn set_non_block(&self, non_block: bool) -> Result<()>
Sets the non-blocking mode of this terminal’s file descriptor.
If non_block is true, then read_raw will not block. If non_block is false, then
read_raw may block if there is nothing to read.