Input

Enum Input 

Source
#[non_exhaustive]
pub enum Input {
Show 14 variants Text(char), Key(Mod, Key, bool), Click(Mod, Btn, bool), PointerLeave, ScrollX(Mod, f32), ScrollY(Mod, f32), PointerX(f32), PointerY(f32), Touch(bool), Pinch(bool), PinchW(f32), PinchH(f32), PinchZ(f32), Controller(Controller),
}
Expand description

Input event from any human interface device

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.
§

Text(char)

User inputted text.

§

Key(Mod, Key, bool)

A key on the keyboard was pressed or released.

§

Click(Mod, Btn, bool)

Pointer button was pressed or released (Left click, Tap).

§

PointerLeave

The pointer has left the window.

§

ScrollX(Mod, f32)

Request to shift the viewport in the X dimension (relative coordinates).

§

ScrollY(Mod, f32)

Request to shift the viewport in the Y dimension (relative coordinates).

§

PointerX(f32)

The pointer was moved in the X dimension (absolute coordinates).

§

PointerY(f32)

The pointer was moved in the Y dimension (absolute coordinates).

§

Touch(bool)

Touchscreen was touched with one finger.

§

Pinch(bool)

Touchscreen was touched with two fingers.

§

PinchW(f32)

Pinch width has changed.

§

PinchH(f32)

Pinch height has changed.

§

PinchZ(f32)

Rotation Amount

§

Controller(Controller)

New controller plugged in.

Implementations§

Source§

impl Input

Source

pub fn listener() -> impl Future<Output = Input>

Get a future that returns input events. You may only call this once, because multiple threads reading the same input wouldn’t logically work.

Trait Implementations§

Source§

impl Debug for Input

Source§

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

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.