sl_console::raw

Trait RawModeExt

Source
pub trait RawModeExt: ConsoleWrite + Sized {
    // Required methods
    fn raw_mode_off(&mut self) -> Result<()>;
    fn raw_mode_on(&mut self) -> Result<()>;
    fn into_raw_mode(self) -> Result<RawTerminal<Self>>;
}
Expand description

Types which can be converted into “raw mode”.

§Why is this type defined on writers and not readers?

TTYs has their state controlled by the writer, not the reader. You use the writer to clear the screen, move the cursor and so on, so naturally you use the writer to change the mode as well.

Required Methods§

Source

fn raw_mode_off(&mut self) -> Result<()>

Switch to original (non-raw) mode

This call needs to also lock the conin (conout will have been locked already). If it can not lock conin it will return an error of kind WouldBlock.

Source

fn raw_mode_on(&mut self) -> Result<()>

Switch to raw mode.

This call needs to also lock the conin (conout will have been locked already). If it can not lock conin it will return an error of kind WouldBlock.

Source

fn into_raw_mode(self) -> Result<RawTerminal<Self>>

Switch to raw mode.

Raw mode means that stdin won’t be printed (it will instead have to be written manually by the program). Furthermore, the input isn’t canonicalised or buffered (that is, you can read from stdin one byte of a time). The output is neither modified in any way.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§