#[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>§raw_midi: TransparentPad<RawMidiInput, __EventUnion_raw_midi_PADDING>Implementations§
Source§impl EventUnion
impl EventUnion
Sourcepub fn try_as_key(&self) -> Result<&KeyInput, CheckedCastError>
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.
Sourcepub fn as_key(&self) -> &KeyInput
pub fn as_key(&self) -> &KeyInput
Access self as key. Same conditions as [try_as_key]but panics on failure.
Sourcepub fn try_as_mouse(&self) -> Result<&MouseInput, CheckedCastError>
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.
Sourcepub fn as_mouse(&self) -> &MouseInput
pub fn as_mouse(&self) -> &MouseInput
Access self as mouse. Same conditions as [try_as_mouse]but panics on failure.
Sourcepub fn try_as_touch(&self) -> Result<&TouchInput, CheckedCastError>
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.
Sourcepub fn as_touch(&self) -> &TouchInput
pub fn as_touch(&self) -> &TouchInput
Access self as touch. Same conditions as [try_as_touch]but panics on failure.
Sourcepub fn try_as_axis(&self) -> Result<&AxisInput, CheckedCastError>
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.
Sourcepub fn as_axis(&self) -> &AxisInput
pub fn as_axis(&self) -> &AxisInput
Access self as axis. Same conditions as [try_as_axis]but panics on failure.
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.
Access self as gamepad_button. Same conditions as [try_as_gamepad_button]but panics on failure.
Sourcepub fn try_as_raw_midi(&self) -> Result<&RawMidiInput, CheckedCastError>
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.
Sourcepub fn as_raw_midi(&self) -> &RawMidiInput
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
impl Clone for EventUnion
Source§fn clone(&self) -> EventUnion
fn clone(&self) -> EventUnion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventUnion
impl Debug for EventUnion
impl AnyBitPattern for EventUnion
impl Copy for EventUnion
impl NoUninit for EventUnion
Auto Trait Implementations§
impl Freeze for EventUnion
impl RefUnwindSafe for EventUnion
impl Send for EventUnion
impl Sync for EventUnion
impl Unpin for EventUnion
impl UnwindSafe for EventUnion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.