Struct tui_textarea::Input
source · [−]Expand description
Backend-agnostic key input type.
When crossterm and/or termion features are enabled, converting their key input types into this Input type is defined.
use tui_textarea::{TextArea, Input, Key};
use crossterm::event::{Event, read};
let event = read().unwrap();
let input = Input::from(event);
if let Event::Key(key) = event {
let input = Input::from(key); // Conversion from `KeyEvent` value is also available
}Creating Input instance directly can cause backend-agnostic input as follows.
use tui_textarea::{TextArea, Input, Key};
let mut textarea = TextArea::default();
// Input Ctrl+A
textarea.input(Input {
key: Key::Char('a'),
ctrl: true,
alt: false,
});Fields
key: KeyTyped key.
ctrl: boolCtrl modifier key. true means Ctrl key was pressed.
alt: boolAlt modifier key. true means Alt key was pressed.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more