Trait base::Terminal

source ·
pub unsafe trait Terminal {
    fn tty_fd(&self) -> RawFd;

    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§

Gets the file descriptor of the TTY.

Provided Methods§

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

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

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§

Implementors§