Trait base::sys::linux::terminal::Terminal

source ·
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§

source

fn tty_fd(&self) -> RawFd

Gets the file descriptor of the TTY.

Provided Methods§

source

fn set_canon_mode(&self) -> Result<()>

Set this terminal’s mode to canonical mode (ICANON | ECHO | ISIG).

source

fn set_raw_mode(&self) -> Result<()>

Set this terminal’s mode to raw mode (!(ICANON | ECHO | ISIG)).

source

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.

Implementations on Foreign Types§

source§

impl Terminal for Stdin

source§

fn tty_fd(&self) -> RawFd

Implementors§