Enum pix_engine::event::Event

source ·
#[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, }, Unhandled,
}
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.

§

Unhandled

An unknown/unsupported event.

Trait Implementations§

source§

impl Clone for Event

source§

fn clone(&self) -> Event

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 Event

source§

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

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

impl Default for Event

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Event

source§

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 PartialEq for Event

source§

fn eq(&self, other: &Event) -> 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 Event

source§

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

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

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

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> ToOwned for T
where 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, U> TryFrom<U> for T
where 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 T
where 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.
§

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

§

fn vzip(self) -> V

source§

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