[−][src]Enum stakker_tui::Key
A keypress
Note that not all possible combinations of keys can actually be
transmitted as an ANSI sequence. Often Ctrl is only recognised
with the 32 ASCII characters from @
to _
. Some of the Meta
combinations can only be generated by pressing Esc quickly
followed by the key.
Variants
Pr(char)
Printable character without Ctrl or Alt
Ctrl(char)
Control key combination. Note that some control keys are
passed through as specific values for convenience:
Key::Tab
for ^I
(ASCII 9), Key::Return
for ^M
(ASCII 13), Key::Esc
for ^[
(ASCII 27) and
Key::BackSp
for ^?
(ASCII 127).
F(u32)
Function key, F1 to F20
Meta(char)
Meta/Alt key combination
MetaCtrl(char)
Meta/Alt with Ctrl key combination
MetaF(u32)
Meta/Alt with function key F1 to F20
Appears before pasted text on some terminals
Appears after pasted text on some terminals
Check
can be sent in a pause in typing, 300ms after the last
keypress. It's a good time to do field validation if that
validation is expensive. See Terminal::check
.
Invalid
is generated for a keypress which cannot be decoded,
e.g. invalid UTF-8 or some other problem
Implementations
impl Key
[src]
pub fn meta(&self) -> Option<Self>
[src]
Add meta to a key if possible, otherwise return None
pub fn decode(data: &[u8], force: bool) -> Option<(usize, Key)>
[src]
Attempt to decode a keypress from data received from the
terminal. Will not decode a partial sequence at the end of
the buffer unless force
is set. Returns count of bytes
consumed and the decoded key, or else None
.
Trait Implementations
impl Debug for Key
[src]
impl Display for Key
[src]
fn fmt(&self, f: &mut Formatter<'_>) -> Result
[src]
Convert to a display string, using M-
and C-
prefixes for
Meta and Ctrl.
impl Eq for Key
[src]
impl FromStr for Key
[src]
type Err = ParseKeyError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Key, ParseKeyError>
[src]
Convert back from the Display
representation of a key
impl PartialEq<Key> for Key
[src]
impl StructuralEq for Key
[src]
impl StructuralPartialEq for Key
[src]
Auto Trait Implementations
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,