[−][src]Trait termwiz::terminal::Terminal
Terminal
abstracts over some basic terminal capabilities.
If the set_raw_mode
or set_cooked_mode
functions are used in
any combination, the implementation is required to restore the
terminal mode that was in effect when it was created.
Required methods
fn set_raw_mode(&mut self) -> Result<(), Error>
Raw mode disables input line buffering, allowing data to be read as the user presses keys, disables local echo, so keys pressed by the user do not implicitly render to the terminal output, and disables canonicalization of unix newlines to CRLF.
fn set_cooked_mode(&mut self) -> Result<()>
fn enter_alternate_screen(&mut self) -> Result<(), Error>
Enter the alternate screen. The alternate screen will be left
automatically when the Terminal
is dropped.
fn exit_alternate_screen(&mut self) -> Result<(), Error>
Exit the alternate screen.
fn get_screen_size(&mut self) -> Result<ScreenSize, Error>
Queries the current screen size, returning width, height.
fn set_screen_size(&mut self, size: ScreenSize) -> Result<(), Error>
Sets the current screen size
fn render(&mut self, changes: &[Change]) -> Result<(), Error>
Render a series of changes to the terminal output
fn flush(&mut self) -> Result<(), Error>
Flush any buffered output
fn poll_input(
&mut self,
wait: Option<Duration>
) -> Result<Option<InputEvent>, Error>
&mut self,
wait: Option<Duration>
) -> Result<Option<InputEvent>, Error>
Check for a parsed input event.
wait
indicates the behavior in the case that no input is
immediately available. If wait is None
then poll_input
will not return until an event is available. If wait is
Some(duration)
then poll_input
will wait up to the given
duration for an event before returning with a value of
Ok(None)
. If wait is Some(Duration::new(0, 0))
then
the poll is non-blocking.
The possible values returned as InputEvent
s depend on the
mode of the terminal. Most values are not returned unless
the terminal is set to raw mode.
fn waker(&self) -> TerminalWaker
Implementors
impl Terminal for UnixTerminal
[src]
fn set_raw_mode(&mut self) -> Result<(), Error>
[src]
fn set_cooked_mode(&mut self) -> Result<()>
[src]
fn enter_alternate_screen(&mut self) -> Result<(), Error>
[src]
fn exit_alternate_screen(&mut self) -> Result<(), Error>
[src]
fn get_screen_size(&mut self) -> Result<ScreenSize, Error>
[src]
fn set_screen_size(&mut self, size: ScreenSize) -> Result<(), Error>
[src]
fn render(&mut self, changes: &[Change]) -> Result<(), Error>
[src]
fn flush(&mut self) -> Result<(), Error>
[src]
fn poll_input(
&mut self,
wait: Option<Duration>
) -> Result<Option<InputEvent>, Error>
[src]
&mut self,
wait: Option<Duration>
) -> Result<Option<InputEvent>, Error>