Function cbreak

fn cbreak() -> int

Put the terminal into cbreak mode.

This is the normal unbuffered mode.

Function cooked

fn cooked() -> int

Put the terminal into cooked mode.

This is the normal line-buffered mode.

Function echo

fn echo(enable: bool) -> int

Change the echo mode of the terminal.

true turns echo on, and false turns echo off.

Function preserve

fn preserve<T>(body: &fn() -> T) -> T

Run a block of code, restoring the terminal state when the block ends.

This will ensure you don't leave the terminal in a broken state, even if the current task fails.

Function raw

fn raw() -> int

Put the terminal into raw mode.

This is like cbreak mode, except that control characters (like ^C) are not translated into signals.

Function size

fn size() -> (uint, uint)

Returns the size of the terminal, as (columns, rows).