[−][src]Trait linefeed::terminal::TerminalReader
Holds a lock on Terminal
read operations
Required methods
fn prepare(
&mut self,
block_signals: bool,
report_signals: SignalSet
) -> Result<Term::PrepareState>
&mut self,
block_signals: bool,
report_signals: SignalSet
) -> Result<Term::PrepareState>
Prepares the terminal for line reading and editing operations.
If block_signals
is true
, the terminal will be configured to treat
special characters that would otherwise be interpreted as signals as
their literal value.
If block_signals
is false
, a signal contained in the report_signals
set may be returned.
Notes
This method may be called more than once. However, if the state values are not restored in reverse order in which they were created, the state of the underlying terminal device becomes undefined.
unsafe fn prepare_with_lock(
&mut self,
lock: &mut dyn TerminalWriter<Term>,
block_signals: bool,
report_signals: SignalSet
) -> Result<Term::PrepareState>
&mut self,
lock: &mut dyn TerminalWriter<Term>,
block_signals: bool,
report_signals: SignalSet
) -> Result<Term::PrepareState>
Like prepare
, but called when the write lock is already held.
Safety
This method must be called with a TerminalWriter
instance returned
by the same Terminal
instance to which this TerminalReader
belongs.
fn restore(&mut self, state: Term::PrepareState) -> Result<()>
Restores the terminal state using the given state data.
unsafe fn restore_with_lock(
&mut self,
lock: &mut dyn TerminalWriter<Term>,
state: Term::PrepareState
) -> Result<()>
&mut self,
lock: &mut dyn TerminalWriter<Term>,
state: Term::PrepareState
) -> Result<()>
Like restore
, but called when the write lock is already held.
Safety
This method must be called with a TerminalWriter
instance returned
by the same Terminal
instance to which this TerminalReader
belongs.
fn read(&mut self, buf: &mut Vec<u8>) -> Result<RawRead>
Reads some input from the terminal and appends it to the given buffer.
fn wait_for_input(&mut self, timeout: Option<Duration>) -> Result<bool>
Waits timeout
for user input. If timeout
is None
, waits indefinitely.
Returns Ok(true)
if input becomes available within the given timeout
or if a signal is received.
Returns Ok(false)
if the timeout expires before input becomes available.
Implementations on Foreign Types
impl<'a> TerminalReader<DefaultTerminal> for TerminalReadGuard<'a>
[src]
fn prepare(
&mut self,
block_signals: bool,
report_signals: SignalSet
) -> Result<PrepareState>
[src]
&mut self,
block_signals: bool,
report_signals: SignalSet
) -> Result<PrepareState>
unsafe fn prepare_with_lock(
&mut self,
lock: &mut dyn TerminalWriter<DefaultTerminal>,
block_signals: bool,
report_signals: SignalSet
) -> Result<PrepareState>
[src]
&mut self,
lock: &mut dyn TerminalWriter<DefaultTerminal>,
block_signals: bool,
report_signals: SignalSet
) -> Result<PrepareState>
fn restore(&mut self, state: PrepareState) -> Result<()>
[src]
unsafe fn restore_with_lock(
&mut self,
lock: &mut dyn TerminalWriter<DefaultTerminal>,
state: PrepareState
) -> Result<()>
[src]
&mut self,
lock: &mut dyn TerminalWriter<DefaultTerminal>,
state: PrepareState
) -> Result<()>
fn read(&mut self, buf: &mut Vec<u8>) -> Result<RawRead>
[src]
fn wait_for_input(&mut self, timeout: Option<Duration>) -> Result<bool>
[src]
Implementors
impl<'a> TerminalReader<MemoryTerminal> for MemoryReadGuard<'a>
[src]
fn wait_for_input(&mut self, _timeout: Option<Duration>) -> Result<bool>
[src]
fn prepare(
&mut self,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
[src]
&mut self,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
unsafe fn prepare_with_lock(
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
[src]
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_block_signals: bool,
_report_signals: SignalSet
) -> Result<()>
fn restore(&mut self, _state: ()) -> Result<()>
[src]
unsafe fn restore_with_lock(
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_state: ()
) -> Result<()>
[src]
&mut self,
_lock: &mut dyn TerminalWriter<MemoryTerminal>,
_state: ()
) -> Result<()>