SportControls

Enum SportControls 

Source
#[non_exhaustive]
pub enum SportControls {
Show 34 variants BaseballBat, GolfClub, RowingMachine, Treadmill, Oar, Slope, Rate, StickSpeed, StickFaceAngle, StickHeelToe, StickFollowThrough, StickTempo, StickType, StickHeight, Putter, OneIron, TwoIron, ThreeIron, FourIron, FiveIron, SixIron, SevenIron, EightIron, NineIron, One0Iron, One1Iron, SandWedge, LoftWedge, PowerWedge, OneWood, ThreeWood, FiveWood, SevenWood, NineWood,
}
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

Usage ID 0x1: “Baseball Bat”

§

GolfClub

Usage ID 0x2: “Golf Club”

§

RowingMachine

Usage ID 0x3: “Rowing Machine”

§

Treadmill

Usage ID 0x4: “Treadmill”

§

Oar

Usage ID 0x30: “Oar”

§

Slope

Usage ID 0x31: “Slope”

§

Rate

Usage ID 0x32: “Rate”

§

StickSpeed

Usage ID 0x33: “Stick Speed”

§

StickFaceAngle

Usage ID 0x34: “Stick Face Angle”

§

StickHeelToe

Usage ID 0x35: “Stick Heel/Toe”

§

StickFollowThrough

Usage ID 0x36: “Stick Follow Through”

§

StickTempo

Usage ID 0x37: “Stick Tempo”

§

StickType

Usage ID 0x38: “Stick Type”

§

StickHeight

Usage ID 0x39: “Stick Height”

§

Putter

Usage ID 0x50: “Putter”

§

OneIron

Usage ID 0x51: “1 Iron”

§

TwoIron

Usage ID 0x52: “2 Iron”

§

ThreeIron

Usage ID 0x53: “3 Iron”

§

FourIron

Usage ID 0x54: “4 Iron”

§

FiveIron

Usage ID 0x55: “5 Iron”

§

SixIron

Usage ID 0x56: “6 Iron”

§

SevenIron

Usage ID 0x57: “7 Iron”

§

EightIron

Usage ID 0x58: “8 Iron”

§

NineIron

Usage ID 0x59: “9 Iron”

§

One0Iron

Usage ID 0x5A: “10 Iron”

§

One1Iron

Usage ID 0x5B: “11 Iron”

§

SandWedge

Usage ID 0x5C: “Sand Wedge”

§

LoftWedge

Usage ID 0x5D: “Loft Wedge”

§

PowerWedge

Usage ID 0x5E: “Power Wedge”

§

OneWood

Usage ID 0x5F: “1 Wood”

§

ThreeWood

Usage ID 0x60: “3 Wood”

§

FiveWood

Usage ID 0x61: “5 Wood”

§

SevenWood

Usage ID 0x62: “7 Wood”

§

NineWood

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

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.