pub trait TerminalReader<Term: Terminal> {
    fn prepare(
        &mut self,
        block_signals: bool,
        report_signals: SignalSet
    ) -> Result<Term::PrepareState>; unsafe fn prepare_with_lock(
        &mut self,
        lock: &mut dyn TerminalWriter<Term>,
        block_signals: bool,
        report_signals: SignalSet
    ) -> Result<Term::PrepareState>; fn restore(&mut self, state: Term::PrepareState) -> Result<()>; unsafe fn restore_with_lock(
        &mut self,
        lock: &mut dyn TerminalWriter<Term>,
        state: Term::PrepareState
    ) -> Result<()>; fn read(&mut self, buf: &mut Vec<u8>) -> Result<RawRead>; fn wait_for_input(&mut self, timeout: Option<Duration>) -> Result<bool>; }
Expand description

Holds a lock on Terminal read operations

Required Methods

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.

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.

Restores the terminal state using the given state data.

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.

Reads some input from the terminal and appends it to the given buffer.

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

Implementors