MouseButton

Enum MouseButton 

Source
#[repr(u8)]
pub enum MouseButton {
Show 32 variants Left = 0, Right = 1, Middle = 2, Back = 3, Forward = 4, Button6 = 5, Button7 = 6, Button8 = 7, Button9 = 8, Button10 = 9, Button11 = 10, Button12 = 11, Button13 = 12, Button14 = 13, Button15 = 14, Button16 = 15, Button17 = 16, Button18 = 17, Button19 = 18, Button20 = 19, Button21 = 20, Button22 = 21, Button23 = 22, Button24 = 23, Button25 = 24, Button26 = 25, Button27 = 26, Button28 = 27, Button29 = 28, Button30 = 29, Button31 = 30, Button32 = 31,
}
Expand description

Identifies a button of a mouse controller.

§Platform-specific

The first three buttons should be supported on all platforms. Self::Back and Self::Forward are supported on most platforms (when using a compatible mouse).

  • Android, iOS: Currently not supported.
  • Orbital: Only left/right/middle buttons are supported at this time.
  • Web, Windows: Supports left/right/middle/back/forward buttons.
  • Wayland: Supports buttons 0..=15.
  • macOS: Supports all button variants.
  • X11: Technically supports further buttons than this (0..=250), these are emitted in ButtonSource::Unknown.

Variants§

§

Left = 0

The primary (usually left) button

§

Right = 1

The secondary (usually right) button

§

Middle = 2

The tertiary (usually middle) button

§

Back = 3

The first side button, frequently assigned a back function

§

Forward = 4

The second side button, frequently assigned a forward function

§

Button6 = 5

The sixth button

§

Button7 = 6

The seventh button

§

Button8 = 7

The eighth button

§

Button9 = 8

The ninth button

§

Button10 = 9

The tenth button

§

Button11 = 10

The eleventh button

§

Button12 = 11

The twelfth button

§

Button13 = 12

The thirteenth button

§

Button14 = 13

The fourteenth button

§

Button15 = 14

The fifteenth button

§

Button16 = 15

The sixteenth button

§

Button17 = 16

§

Button18 = 17

§

Button19 = 18

§

Button20 = 19

§

Button21 = 20

§

Button22 = 21

§

Button23 = 22

§

Button24 = 23

§

Button25 = 24

§

Button26 = 25

§

Button27 = 26

§

Button28 = 27

§

Button29 = 28

§

Button30 = 29

§

Button31 = 30

§

Button32 = 31

Implementations§

Source§

impl MouseButton

Source

pub fn try_from_u8(b: u8) -> Option<MouseButton>

Construct from a u8 if within the range 0..=31

Trait Implementations§

Source§

impl Clone for MouseButton

Source§

fn clone(&self) -> MouseButton

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 MouseButton

Source§

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

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

impl From<MouseButton> for ButtonSource

Source§

fn from(mouse: MouseButton) -> Self

Converts to this type from the input type.
Source§

impl Hash for MouseButton

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for MouseButton

Source§

fn cmp(&self, other: &MouseButton) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for MouseButton

Source§

fn eq(&self, other: &MouseButton) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for MouseButton

Source§

fn partial_cmp(&self, other: &MouseButton) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for MouseButton

Source§

impl Eq for MouseButton

Source§

impl StructuralPartialEq for MouseButton

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