pub struct Joystick { /* private fields */ }
Expand description

A physical joystick device manages its states, input devices and power levels.

Implementations§

source§

impl Joystick

source

pub fn from_id(id: JoystickId<'_>) -> Option<Self>

Constructs from JoystickId if it is valid.

source

pub fn instance_id(&self) -> JoystickId<'_>

Returns the instance id JoystickId.

source

pub fn power_level(&self) -> PowerLevel

Returns the power level of the joystick.

source

pub fn guid(&self) -> Guid

Returns the GUID of the joystick.

source

pub fn name(&self) -> Cow<'_, str>

Returns the name of the joystick.

source

pub fn enable(&self)

Turns the joystick into enable.

source

pub fn disable(&self)

Turns the joystick into disable.

source

pub fn is_enabled(&self) -> bool

Returns whether the joystick is enabled.

source

pub fn axes(&self) -> Axes<'_>

Returns axes Axes that the joystick has.

source

pub fn axis(&self, index: InputIndex) -> Option<Axis<'_>>

Returns an axis of index if it exists.

source

pub fn trackballs(&self) -> Trackballs<'_>

Returns trackballs Trackballs that the joystick has.

source

pub fn trackball(&self, index: InputIndex) -> Option<Trackball<'_>>

Returns a trackball of index if it exists.

source

pub fn buttons(&self) -> Buttons<'_>

Returns buttons Buttons that the joystick has.

source

pub fn button(&self, index: InputIndex) -> Option<Button<'_>>

Returns a button of index if it exists.

source

pub fn hats(&self) -> Hats<'_>

Returns hats Hats that the joystick has.

source

pub fn hat(&self, index: InputIndex) -> Option<Hat<'_>>

Returns a hat of index if it exists.

Trait Implementations§

source§

impl Clone for Joystick

source§

fn clone(&self) -> Joystick

Returns a copy 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 Joystick

source§

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

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

impl From<GameController> for Joystick

source§

fn from(gc: GameController) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Joystick

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Joystick

source§

impl StructuralPartialEq for Joystick

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> ToOwned for T
where T: Clone,

§

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

§

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.