SportControls

Enum SportControls 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum SportControls {
Show 34 variants BaseballBat = 1, GolfClub = 2, RowingMachine = 3, Treadmill = 4, Oar = 48, Slope = 49, Rate = 50, StickSpeed = 51, StickFaceAngle = 52, StickHeelToe = 53, StickFollowThrough = 54, StickTempo = 55, StickType = 56, StickHeight = 57, Putter = 80, OneIron = 81, TwoIron = 82, ThreeIron = 83, FourIron = 84, FiveIron = 85, SixIron = 86, SevenIron = 87, EightIron = 88, NineIron = 89, One0Iron = 90, One1Iron = 91, SandWedge = 92, LoftWedge = 93, PowerWedge = 94, OneWood = 95, ThreeWood = 96, FiveWood = 97, SevenWood = 98, NineWood = 99,
}
Expand description

Usage Page 0x4: “Sport Controls”

This enum is autogenerated from the HID Usage Tables.

let u1 = Usage::SportControls(SportControls::GolfClub);
let u2 = Usage::new_from_page_and_id(0x4, 0x2).unwrap();
let u3 = Usage::from(SportControls::GolfClub);
let u4: Usage = SportControls::GolfClub.into();
assert_eq!(u1, u2);
assert_eq!(u1, u3);
assert_eq!(u1, u4);

assert!(matches!(u1.usage_page(), UsagePage::SportControls));
assert_eq!(0x4, u1.usage_page_value());
assert_eq!(0x2, u1.usage_id_value());
assert_eq!((0x4 << 16) | 0x2, u1.usage_value());
assert_eq!("Golf Club", u1.name());

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

BaseballBat = 1

Usage ID 0x1: “Baseball Bat”

§

GolfClub = 2

Usage ID 0x2: “Golf Club”

§

RowingMachine = 3

Usage ID 0x3: “Rowing Machine”

§

Treadmill = 4

Usage ID 0x4: “Treadmill”

§

Oar = 48

Usage ID 0x30: “Oar”

§

Slope = 49

Usage ID 0x31: “Slope”

§

Rate = 50

Usage ID 0x32: “Rate”

§

StickSpeed = 51

Usage ID 0x33: “Stick Speed”

§

StickFaceAngle = 52

Usage ID 0x34: “Stick Face Angle”

§

StickHeelToe = 53

Usage ID 0x35: “Stick Heel/Toe”

§

StickFollowThrough = 54

Usage ID 0x36: “Stick Follow Through”

§

StickTempo = 55

Usage ID 0x37: “Stick Tempo”

§

StickType = 56

Usage ID 0x38: “Stick Type”

§

StickHeight = 57

Usage ID 0x39: “Stick Height”

§

Putter = 80

Usage ID 0x50: “Putter”

§

OneIron = 81

Usage ID 0x51: “1 Iron”

§

TwoIron = 82

Usage ID 0x52: “2 Iron”

§

ThreeIron = 83

Usage ID 0x53: “3 Iron”

§

FourIron = 84

Usage ID 0x54: “4 Iron”

§

FiveIron = 85

Usage ID 0x55: “5 Iron”

§

SixIron = 86

Usage ID 0x56: “6 Iron”

§

SevenIron = 87

Usage ID 0x57: “7 Iron”

§

EightIron = 88

Usage ID 0x58: “8 Iron”

§

NineIron = 89

Usage ID 0x59: “9 Iron”

§

One0Iron = 90

Usage ID 0x5A: “10 Iron”

§

One1Iron = 91

Usage ID 0x5B: “11 Iron”

§

SandWedge = 92

Usage ID 0x5C: “Sand Wedge”

§

LoftWedge = 93

Usage ID 0x5D: “Loft Wedge”

§

PowerWedge = 94

Usage ID 0x5E: “Power Wedge”

§

OneWood = 95

Usage ID 0x5F: “1 Wood”

§

ThreeWood = 96

Usage ID 0x60: “3 Wood”

§

FiveWood = 97

Usage ID 0x61: “5 Wood”

§

SevenWood = 98

Usage ID 0x62: “7 Wood”

§

NineWood = 99

Usage ID 0x63: “9 Wood”

Implementations§

Trait Implementations§

Source§

impl AsUsage for SportControls

Source§

fn usage_value(&self) -> u32

Returns the 32 bit Usage value of this Usage

Source§

fn usage_id_value(&self) -> u16

Returns the 16 bit Usage ID value of this Usage

Source§

fn usage(&self) -> Usage

Returns this usage as Usage::SportControls(self) This is a convenience function to avoid having to implement From for every used type in the caller.

let gd_x = GenericDesktop::X;
let usage = Usage::from(GenericDesktop::X);
assert!(matches!(gd_x.usage(), usage));
Source§

impl AsUsagePage for SportControls

Source§

fn usage_page_value(&self) -> u16

Returns the 16 bit value of this UsagePage

This value is 0x4 for SportControls

Source§

fn usage_page(&self) -> UsagePage

Source§

impl BitOr<u16> for SportControls

Source§

fn bitor(self, usage: u16) -> Usage

A convenience function to combine a Usage Page with a value.

This function panics if the Usage ID value results in an unknown Usage. Where error checking is required, use UsagePage::to_usage_from_value.

Source§

type Output = Usage

The resulting type after applying the | operator.
Source§

impl Clone for SportControls

Source§

fn clone(&self) -> SportControls

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 SportControls

Source§

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

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

impl Display for SportControls

Available on crate feature std only.
Source§

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

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

impl From<&SportControls> for Usage

Source§

fn from(sportcontrols: &SportControls) -> Usage

Converts to this type from the input type.
Source§

impl From<&SportControls> for UsagePage

Source§

impl From<&SportControls> for u16

Source§

fn from(sportcontrols: &SportControls) -> u16

Converts to this type from the input type.
Source§

impl From<&SportControls> for u32

Source§

fn from(sportcontrols: &SportControls) -> u32

Returns the 32 bit value of this usage. This is identical to SportControls::usage_value().

Source§

impl From<SportControls> for Usage

Source§

fn from(sportcontrols: SportControls) -> Usage

Converts to this type from the input type.
Source§

impl From<SportControls> for UsagePage

Source§

impl From<SportControls> for u16

Source§

fn from(sportcontrols: SportControls) -> u16

Returns the 16bit value of this usage. This is identical to SportControls::usage_page_value().

Source§

impl Hash for SportControls

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

Source§

fn eq(&self, other: &SportControls) -> 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 TryFrom<u16> for SportControls

Source§

type Error = HutError

The type returned in the event of a conversion error.
Source§

fn try_from(usage_id: u16) -> Result<SportControls, HutError>

Performs the conversion.
Source§

impl Copy for SportControls

Source§

impl Eq for SportControls

Source§

impl StructuralPartialEq for SportControls

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.