pub struct Input { /* private fields */ }
Expand description
Manages handling terminal input from stdin
.
The primary interface provided is read_key
. You can
additionally configure the types of keypresses you are interested in
through the parse_*
methods. This configuration can be changed between
any two calls to read_key
.
Creates a new Input
instance containing a RawGuard
instance.
Error::SetTerminalMode
: failed to put the terminal into raw mode
Creates a new Input
instance without creating a
RawGuard
instance.
Removes the RawGuard
instance stored in this Input
instance and returns it. This can be useful if you need to manage the
lifetime of the RawGuard
instance separately.
Sets whether read_key
should try to produce
String
or Char
keys when
possible, rather than Bytes
or
Byte
keys. Note that
Bytes
or Byte
keys may
still be produced if the input fails to be parsed as UTF-8. Defaults
to true.
Sets whether read_key
should produce Ctrl
keys
when possible, rather than Bytes
or
Byte
keys. Defaults to true.
Sets whether read_key
should produce Meta
keys
when possible, rather than producing the
Escape
key separately. Defaults to true.
Sets whether read_key
should produce individual
Char
or Byte
keys, rather
than combining them into String
or
Bytes
keys when possible. When this is true,
String
and Bytes
will
never be returned, and when this is false, Char
and Byte
will never be returned. Defaults to
true.
Reads a keypress from the terminal on stdin
. Returns Ok(None)
on
EOF.
Error::ReadStdin
: failed to read data from stdin
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.