Union EventUnion

Source
#[repr(C)]
pub union EventUnion {
    pub key: TransparentPad<KeyInput, __EventUnion_key_PADDING>,
    pub mouse: TransparentPad<MouseInput, __EventUnion_mouse_PADDING>,
    pub touch: TransparentPad<TouchInput, __EventUnion_touch_PADDING>,
    pub axis: TransparentPad<AxisInput, __EventUnion_axis_PADDING>,
    pub gamepad_button: TransparentPad<GamepadButtonInput, __EventUnion_gamepad_button_PADDING>,
    pub raw_midi: TransparentPad<RawMidiInput, __EventUnion_raw_midi_PADDING>,
}

Fields§

§key: TransparentPad<KeyInput, __EventUnion_key_PADDING>§mouse: TransparentPad<MouseInput, __EventUnion_mouse_PADDING>§touch: TransparentPad<TouchInput, __EventUnion_touch_PADDING>§axis: TransparentPad<AxisInput, __EventUnion_axis_PADDING>§gamepad_button: TransparentPad<GamepadButtonInput, __EventUnion_gamepad_button_PADDING>§raw_midi: TransparentPad<RawMidiInput, __EventUnion_raw_midi_PADDING>

Implementations§

Source§

impl EventUnion

Source

pub fn try_as_key(&self) -> Result<&KeyInput, CheckedCastError>

Attempt to access self as key.

Will succeed if the cast is safe, even if key was not the logically inhabited formof self, i.e. does not check that self was last written as key as longas the underlying memory is safe (not necessarily logical) to interpret as key.

Source

pub fn as_key(&self) -> &KeyInput

Access self as key. Same conditions as [try_as_key]but panics on failure.

Source

pub fn try_as_mouse(&self) -> Result<&MouseInput, CheckedCastError>

Attempt to access self as mouse.

Will succeed if the cast is safe, even if mouse was not the logically inhabited formof self, i.e. does not check that self was last written as mouse as longas the underlying memory is safe (not necessarily logical) to interpret as mouse.

Source

pub fn as_mouse(&self) -> &MouseInput

Access self as mouse. Same conditions as [try_as_mouse]but panics on failure.

Source

pub fn try_as_touch(&self) -> Result<&TouchInput, CheckedCastError>

Attempt to access self as touch.

Will succeed if the cast is safe, even if touch was not the logically inhabited formof self, i.e. does not check that self was last written as touch as longas the underlying memory is safe (not necessarily logical) to interpret as touch.

Source

pub fn as_touch(&self) -> &TouchInput

Access self as touch. Same conditions as [try_as_touch]but panics on failure.

Source

pub fn try_as_axis(&self) -> Result<&AxisInput, CheckedCastError>

Attempt to access self as axis.

Will succeed if the cast is safe, even if axis was not the logically inhabited formof self, i.e. does not check that self was last written as axis as longas the underlying memory is safe (not necessarily logical) to interpret as axis.

Source

pub fn as_axis(&self) -> &AxisInput

Access self as axis. Same conditions as [try_as_axis]but panics on failure.

Source

pub fn try_as_gamepad_button( &self, ) -> Result<&GamepadButtonInput, CheckedCastError>

Attempt to access self as gamepad_button.

Will succeed if the cast is safe, even if gamepad_button was not the logically inhabited formof self, i.e. does not check that self was last written as gamepad_button as longas the underlying memory is safe (not necessarily logical) to interpret as gamepad_button.

Source

pub fn as_gamepad_button(&self) -> &GamepadButtonInput

Access self as gamepad_button. Same conditions as [try_as_gamepad_button]but panics on failure.

Source

pub fn try_as_raw_midi(&self) -> Result<&RawMidiInput, CheckedCastError>

Attempt to access self as raw_midi.

Will succeed if the cast is safe, even if raw_midi was not the logically inhabited formof self, i.e. does not check that self was last written as raw_midi as longas the underlying memory is safe (not necessarily logical) to interpret as raw_midi.

Source

pub fn as_raw_midi(&self) -> &RawMidiInput

Access self as raw_midi. Same conditions as [try_as_raw_midi]but panics on failure.

Trait Implementations§

Source§

impl Clone for EventUnion

Source§

fn clone(&self) -> EventUnion

Returns a duplicate 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 EventUnion

Source§

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

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

impl Zeroable for EventUnion

Source§

fn zeroed() -> Self

Source§

impl AnyBitPattern for EventUnion

Source§

impl Copy for EventUnion

Source§

impl NoUninit for EventUnion

Auto Trait Implementations§

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

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.