#[non_exhaustive]
pub enum Event {
Show 29 variants Quit, AppTerminating, Window { window_id: u32, win_event: WindowEvent, }, KeyDown { key: Option<Key>, keymod: KeyMod, repeat: bool, }, KeyUp { key: Option<Key>, keymod: KeyMod, repeat: bool, }, TextInput { text: String, }, MouseMotion { x: i32, y: i32, xrel: i32, yrel: i32, }, MouseDown { button: Mouse, x: i32, y: i32, }, MouseUp { button: Mouse, x: i32, y: i32, }, MouseWheel { x: i32, y: i32, }, JoyAxisMotion { joy_id: u32, axis_idx: u8, value: i16, }, JoyHatMotion { joy_id: u32, hat_idx: u8, state: HatState, }, JoyBallMotion { joy_id: u32, ball_idx: u8, xrel: i16, yrel: i16, }, JoyDown { joy_id: u32, button_idx: u8, }, JoyUp { joy_id: u32, button_idx: u8, }, JoyDeviceAdded { joy_id: u32, }, JoyDeviceRemoved { joy_id: u32, }, ControllerAxisMotion { controller_id: u32, axis: Axis, value: i16, }, ControllerDown { controller_id: u32, button: ControllerButton, }, ControllerUp { controller_id: u32, button: ControllerButton, }, ControllerAdded { controller_id: u32, }, ControllerRemoved { controller_id: u32, }, ControllerRemapped { controller_id: u32, }, FingerDown { touch_id: i64, finger_id: i64, x: f32, y: f32, dx: f32, dy: f32, pressure: f32, }, FingerUp { touch_id: i64, finger_id: i64, x: f32, y: f32, dx: f32, dy: f32, pressure: f32, }, FingerMotion { touch_id: i64, finger_id: i64, x: f32, y: f32, dx: f32, dy: f32, pressure: f32, }, AudioDeviceAdded { device_id: u32, iscapture: bool, }, AudioDeviceRemoved { device_id: u32, iscapture: bool, }, Unsupported,
}
Expand description

System or User Event.

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.

Quit

System quit event for the application.

AppTerminating

System termination event for the application.

Window

Fields

window_id: u32

Window identifer for this event.

win_event: WindowEvent

Specific window event.

Window events.

KeyDown

Fields

key: Option<Key>

Specific key being pressed.

keymod: KeyMod

Key modifiers being held upon press, e.g. Shift or Ctrl, etc.

repeat: bool

Whether this is a key-repeat event.

User key press event.

KeyUp

Fields

key: Option<Key>

Specific key being released.

keymod: KeyMod

Key modifiers being held upon release, e.g. Shift or Ctrl, etc.

repeat: bool

Whether this is a key-repeat event.

User key release event.

TextInput

Fields

text: String

The user-entered text.

User text entry event.

MouseMotion

Fields

x: i32

Current horizontal mouse position after motion.

y: i32

Current vertical mouse position after motion.

xrel: i32

Relative horizontal screen movement since last event.

yrel: i32

Relative vertical screen movement since last event.

User mouse movement event.

MouseDown

Fields

button: Mouse

Specific mouse button being clicked.

x: i32

Current horizontal mouse position after click.

y: i32

Current vertical mouse position after click.

User mouse click event.

MouseUp

Fields

button: Mouse

Specific mouse button being released.

x: i32

Current horizontal mouse position after release.

y: i32

Current vertical mouse position after release.

User mouse release event.

MouseWheel

Fields

x: i32

Relative horizontal wheel offset.

y: i32

Relative vertical wheel offset.

User mouse wheel event.

JoyAxisMotion

Fields

joy_id: u32

Specific attached joystick identifier.

axis_idx: u8

Specific joystick axis being moved.

value: i16

Relative value of axis motion.

User joystick axis movement event.

JoyHatMotion

Fields

joy_id: u32

Specific attached joystick identifier.

hat_idx: u8

Specific joystick hat being moved.

state: HatState

Hat state.

User joystick hat movement event.

JoyBallMotion

Fields

joy_id: u32

Specific attached joystick identifier.

ball_idx: u8

Specific joystick ball being moved.

xrel: i16

Relative horizontal value of ball motion.

yrel: i16

Relative vertical value of ball motion.

User joystick ball movement event.

JoyDown

Fields

joy_id: u32

Specific attached joystick identifier.

button_idx: u8

Specific joystick button being pressed.

User joystick button pressed event.

JoyUp

Fields

joy_id: u32

Specific attached joystick identifier.

button_idx: u8

Specific joystick button being released.

User joystick button released event.

JoyDeviceAdded

Fields

joy_id: u32

Specific attached joystick identifier.

User joystick connected event.

JoyDeviceRemoved

Fields

joy_id: u32

Specific attached joystick identifier.

User joystick disconnected event.

ControllerAxisMotion

Fields

controller_id: u32

Specific attached controller identifier.

axis: Axis

Specific controller axis being moved.

value: i16

Relative value of axis motion.

User controller axis movement event.

ControllerDown

Fields

controller_id: u32

Specific attached controller identifier.

button: ControllerButton

Specific controller button being pressed.

User controller button pressed event.

ControllerUp

Fields

controller_id: u32

Specific attached controller identifier.

button: ControllerButton

Specific controller button being released.

User controller button released event.

ControllerAdded

Fields

controller_id: u32

Specific attached controller identifier.

User controller connected event.

ControllerRemoved

Fields

controller_id: u32

Specific attached controller identifier.

User controller disconnected event.

ControllerRemapped

Fields

controller_id: u32

Specific attached controller identifier.

User controller remapped event.

FingerDown

Fields

touch_id: i64

Specific touch device identifier.

finger_id: i64

Specific finger identifier.

x: f32

Current horizontal finger position after press.

y: f32

Current vertical finger position after press.

dx: f32

Relative horizontal finger position since last event.

dy: f32

Relative vertical finger position since last event.

pressure: f32

Amount of finger pressure being applied during press.

User finger press event.

FingerUp

Fields

touch_id: i64

Specific touch device identifier.

finger_id: i64

Specific finger identifier.

x: f32

Current horizontal finger position after press.

y: f32

Current vertical finger position after press.

dx: f32

Relative horizontal finger position since last event.

dy: f32

Relative vertical finger position since last event.

pressure: f32

Amount of finger pressure being applied during press.

User finger released event.

FingerMotion

Fields

touch_id: i64

Specific touch device identifier.

finger_id: i64

Specific finger identifier.

x: f32

Current horizontal finger position after press.

y: f32

Current vertical finger position after press.

dx: f32

Relative horizontal finger position since last event.

dy: f32

Relative vertical finger position since last event.

pressure: f32

Amount of finger pressure being applied during press.

User finger movement event.

AudioDeviceAdded

Fields

device_id: u32

Specific audio device identifier.

iscapture: bool

Whether this device is a capture device or not.

Audio device connected event.

AudioDeviceRemoved

Fields

device_id: u32

Specific audio device identifier.

iscapture: bool

Whether this device is a capture device or not.

Audio device disconnected event.

Unsupported

An unknown/unsupported event.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.