#[repr(u8)]pub enum EventButton {
Left,
Right,
Middle,
X1,
X2,
X3,
X4,
X5,
Other(u8),
}event only.Expand description
๐ซ ๐ฎ โ A normalized pressable pointer/mouse button.
๐ ui/event::EventButton
๐ฆ size_of::<EventButton>() == 2 bytes / 16 bits
โ๏ธOption<T> ๐ฐ T
Left, Middle, and Right represent the three primary conventional buttons.
X1..X5 represent additional auxiliary button slots when a backend can report them.
These variants name normalized button slots, not guaranteed user actions.
For example, X1 is often used as โbackโ, X2 as โforwardโ, and on
Pointer Events a pen eraser may be reported through an auxiliary slot.
Variantsยง
Left
๐ฑ Left mouse button.
Right
Right mouse button.
Middle
Middle mouse button (usually the scroll wheel button).
X1
The first auxiliary mouse button, commonly โbackโ.
X2
The second auxiliary mouse button, commonly โforwardโ.
X3
The third auxiliary mouse button.
X4
The fourth auxiliary mouse button.
X5
The fifth auxiliary mouse button.
Other(u8)
Additional buttons (e.g., side buttons on advanced mice).
Implementationsยง
Sourceยงimpl EventButton
impl EventButton
Sourcepub const fn from_one_bit_mask(mask: EventButtons) -> Option<EventButton> โ
pub const fn from_one_bit_mask(mask: EventButtons) -> Option<EventButton> โ
Returns the button represented by the mask, if exactly one button is set.
Sourcepub const fn to_mask(self) -> EventButtons
pub const fn to_mask(self) -> EventButtons
Returns this button as a held-button mask, if it has a normalized role.
Sourceยงimpl EventButton
impl EventButton
Sourcepub const fn from_web(js_button: u8) -> Option<Self> โ
Available on crate feature web only.
pub const fn from_web(js_button: u8) -> Option<Self> โ
web only.Converts a DOM-compatible button value into a normalized button slot.
This preserves the reported button slot. It does not assign contextual roles such as โbackโ, โforwardโ, โbarrelโ, or โeraserโ.
Trait Implementationsยง
Sourceยงimpl Clone for EventButton
impl Clone for EventButton
Sourceยงfn clone(&self) -> EventButton
fn clone(&self) -> EventButton
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl ConstInit for EventButton
impl ConstInit for EventButton
impl Copy for EventButton
Sourceยงimpl Debug for EventButton
impl Debug for EventButton
Sourceยงimpl Default for EventButton
impl Default for EventButton
Sourceยงfn default() -> EventButton
fn default() -> EventButton
impl Eq for EventButton
Sourceยงimpl Hash for EventButton
impl Hash for EventButton
Sourceยงimpl PartialEq for EventButton
impl PartialEq for EventButton
impl StructuralPartialEq for EventButton
Auto Trait Implementationsยง
impl Freeze for EventButton
impl RefUnwindSafe for EventButton
impl Send for EventButton
impl Sync for EventButton
impl Unpin for EventButton
impl UnsafeUnpin for EventButton
impl UnwindSafe for EventButton
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.