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();
// `Input::from` can convert backend-native event into `Input`
let input = Input::from(event);
// or `Into::into`
let input: Input = event.into();
// Conversion from `KeyEvent` value is also available
if let Event::Key(key) = event {
let input = Input::from(key);
}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
sourceimpl From<Event> for Input
impl From<Event> for Input
sourcefn from(event: CrosstermEvent) -> Self
fn from(event: CrosstermEvent) -> Self
Convert crossterm::event::Event to Input.
sourceimpl From<Event> for Input
impl From<Event> for Input
sourcefn from(event: TerimonEvent) -> Self
fn from(event: TerimonEvent) -> Self
Convert termion::event::Event to Input.
sourceimpl From<Key> for Input
impl From<Key> for Input
sourcefn from(key: TermionKey) -> Self
fn from(key: TermionKey) -> Self
Convert termion::event::Key to Input.
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