Struct gilrs_core::Gamepad

source ·
#[repr(transparent)]
pub struct Gamepad { pub(crate) inner: Gamepad, }
Expand description

Provides information about gamepad.

Fields§

§inner: Gamepad

Implementations§

source§

impl Gamepad

source

pub fn name(&self) -> &str

Returns name of gamepad.

source

pub fn is_connected(&self) -> bool

Returns true if gamepad is connected.

source

pub fn uuid(&self) -> [u8; 16]

Returns UUID that represents gamepad model.

Returned UUID should be the same as SLD2 uses. If platform does not provide any method to distinguish between gamepad models, nil UUID is returned.

It is recommended to process with the UUID crate. Use Uuid::from_bytes method to create a Uuid from the returned bytes.

source

pub fn vendor_id(&self) -> Option<u16>

Returns the vendor ID, as assigned by the USB-IF, when available.

source

pub fn product_id(&self) -> Option<u16>

Returns the product ID, as assigned by the vendor, when available.

source

pub fn power_info(&self) -> PowerInfo

Returns device’s power supply state.

source

pub fn is_ff_supported(&self) -> bool

Returns true if force feedback is supported by device,

source

pub fn ff_device(&self) -> Option<FfDevice>

Creates FfDevice corresponding to this gamepad.

source

pub fn buttons(&self) -> &[EvCode]

Returns slice with EvCodes that may appear in button related events.

source

pub fn axes(&self) -> &[EvCode]

Returns slice with EvCodes that may appear in axis related events.

source

pub fn axis_info(&self, nec: EvCode) -> Option<&AxisInfo>

Returns information about specific axis. None may be returned if device doesn’t have axis with provided EvCode.

Trait Implementations§

source§

impl Debug for Gamepad

source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.