#[non_exhaustive]
pub enum InputEvent {
    Keyboard(KeyPress),
    Resize(Size),
    Mouse(MouseInput),
    Focus(FocusEvent),
    Paste(String),
}
Expand description

Please see KeyPress for more information about handling keyboard input.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Keyboard(KeyPress)

§

Resize(Size)

§

Mouse(MouseInput)

§

Focus(FocusEvent)

§

Paste(String)

A string that was pasted into the terminal. Only emitted if bracketed-paste feature has been enabled for crossterm in Cargo.toml.

Implementations§

source§

impl InputEvent

source

pub fn matches_keypress(&self, other: KeyPress) -> bool

source

pub fn matches_any_of_these_keypresses(&self, others: &[KeyPress]) -> bool

source§

impl InputEvent

source

pub fn matches(&self, exit_keys: &[InputEvent]) -> bool

Checks to see whether the input_event matches any of the exit_keys. Returns true if it does and false otherwise.

Trait Implementations§

source§

impl Clone for InputEvent

source§

fn clone(&self) -> InputEvent

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for InputEvent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for InputEvent

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<InputEvent, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for InputEvent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

For ToString.

source§

impl From<(u16, u16)> for InputEvent

source§

fn from(size: (u16, u16)) -> InputEvent

Typecast / convert [(u16, u16)] to InputEvent::Resize.

source§

impl From<MouseEvent> for InputEvent

source§

fn from(mouse_event: MouseEvent) -> InputEvent

Typecast / convert MouseEvent to InputEvent::Mouse.

source§

impl PartialEq<InputEvent> for InputEvent

source§

fn eq(&self, other: &InputEvent) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for InputEvent

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&InputEvent> for EditorEvent

§

type Error = String

The type returned in the event of a conversion error.
source§

fn try_from( input_event: &InputEvent ) -> Result<EditorEvent, <EditorEvent as TryFrom<&InputEvent>>::Error>

Performs the conversion.
source§

impl TryFrom<Event> for InputEvent

source§

fn try_from( event: Event ) -> Result<InputEvent, <InputEvent as TryFrom<Event>>::Error>

Typecast / convert Event to InputEvent.

§

type Error = ()

The type returned in the event of a conversion error.
source§

impl TryFrom<KeyEvent> for InputEvent

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from( key_event: KeyEvent ) -> Result<InputEvent, <InputEvent as TryFrom<KeyEvent>>::Error>

Performs the conversion.
source§

impl Eq for InputEvent

source§

impl StructuralEq for InputEvent

source§

impl StructuralPartialEq for InputEvent

Auto Trait Implementations§

Blanket Implementations§

source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere T: FloatComponent, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

source§

fn adapt_into_using<M>(self, method: M) -> Dwhere M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> IntoColor<U> for Twhere U: FromColor<T>,

source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
source§

impl<T, U> IntoColorUnclamped<U> for Twhere U: FromColorUnclamped<T>,

source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U> TryIntoColor<U> for Twhere U: TryFromColor<T>,

source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,