Struct tui_textarea::Input
source · pub struct Input {
pub key: Key,
pub ctrl: bool,
pub alt: bool,
pub shift: bool,
}Expand description
Backend-agnostic key input type.
When crossterm, termion, termwiz features are enabled, converting respective 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.clone());
// or `Into::into`
let input: Input = event.clone().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,
shift: 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.
shift: boolShift modifier key. true means Shift key was pressed.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Input
impl<'de> Deserialize<'de> for Input
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<InputEvent> for Input
impl From<InputEvent> for Input
source§fn from(input: InputEvent) -> Self
fn from(input: InputEvent) -> Self
Convert termwiz::input::InputEvent into Input.
source§impl From<MouseEvent> for Input
impl From<MouseEvent> for Input
source§fn from(mouse: MouseEvent) -> Self
fn from(mouse: MouseEvent) -> Self
Convert termion::event::MouseEvent into Input.
source§impl From<MouseEvent> for Input
impl From<MouseEvent> for Input
source§fn from(mouse: MouseEvent) -> Self
fn from(mouse: MouseEvent) -> Self
Convert crossterm::event::MouseEvent into Input.
source§impl From<MouseEvent> for Input
impl From<MouseEvent> for Input
source§fn from(mouse: MouseEvent) -> Self
fn from(mouse: MouseEvent) -> Self
Convert termwiz::input::MouseEvent into Input.
source§impl From<PixelMouseEvent> for Input
impl From<PixelMouseEvent> for Input
source§fn from(mouse: PixelMouseEvent) -> Self
fn from(mouse: PixelMouseEvent) -> Self
Convert termwiz::input::PixelMouseEvent into Input.
source§impl PartialEq for Input
impl PartialEq for Input
impl Eq for Input
impl StructuralPartialEq for Input
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more