[][src]Trait sys_util::Terminal

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<()> { ... }
fn read_raw(&self, out: &mut [u8]) -> Result<usize> { ... } }

Trait for file descriptors that are TTYs, according to isatty(3).

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

fn tty_fd(&self) -> RawFd

Gets the file descriptor of the TTY.

Loading content...

Provided methods

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

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

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

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

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.

fn read_raw(&self, out: &mut [u8]) -> Result<usize>

Reads up to out.len() bytes from this terminal without any buffering.

This may block, depending on if non-blocking was enabled with set_non_block or if there are any bytes to read. If there is at least one byte that is readable, this will not block.

Loading content...

Implementations on Foreign Types

impl<'a> Terminal for StdinLock<'a>[src]

fn set_canon_mode(&self) -> Result<()>[src]

fn set_raw_mode(&self) -> Result<()>[src]

fn set_non_block(&self, non_block: bool) -> Result<()>[src]

fn read_raw(&self, out: &mut [u8]) -> Result<usize>[src]

Loading content...

Implementors

Loading content...