sl_console::input

Trait ConsoleReadExt

Source
pub trait ConsoleReadExt {
    // Required methods
    fn events_and_raw(self) -> EventsAndRaw<Self> 
       where Self: Sized;
    fn events(self) -> Events<Self> 
       where Self: Sized;
    fn keys(self) -> Keys<Self> 
       where Self: Sized;
    fn get_event(&mut self) -> Option<Result<Event>>;
    fn get_event_timeout(&mut self, timeout: Duration) -> Option<Result<Event>>;
    fn get_key(&mut self) -> Option<Result<Key>>;
}
Expand description

Extension to ConsoleRead trait.

Required Methods§

Source

fn events_and_raw(self) -> EventsAndRaw<Self>
where Self: Sized,

An iterator over input events and the raw bytes that make them.

Source

fn events(self) -> Events<Self>
where Self: Sized,

An iterator over input events.

Source

fn keys(self) -> Keys<Self>
where Self: Sized,

An iterator over key inputs.

Source

fn get_event(&mut self) -> Option<Result<Event>>

Get the next input event from the console. This version will block until an event is ready. Returns None if the Console has no more data vs a read that would block.

Source

fn get_event_timeout(&mut self, timeout: Duration) -> Option<Result<Event>>

Get the next input event from the console.

If no data is ready before timeout then will return a WouldBlock error. Returns None if the Console has no more data vs a read that would block.

Source

fn get_key(&mut self) -> Option<Result<Key>>

Get the next key event from the console.

This will skip over non-key events (they will be lost). This version will block until an event is ready. Returns None if the Console has no more data.

Implementors§