Skip to main content

Device

Struct Device 

Source
pub struct Device { /* private fields */ }

Implementations§

Source§

impl Device

Source

pub fn open<P>(path: P) -> Result<Self, Error>
where P: AsRef<Path>,

Source

pub fn id(&self) -> Result<DeviceId, Error>

Source

pub fn name(&self) -> Result<String, Error>

Source

pub fn physical_location(&self) -> Result<String, Error>

Source

pub fn read( &self, timeout: Option<Duration>, ) -> Result<Option<InputEvent>, Error>

Source

pub fn get_raw_abs_info(&self, axis: AbsoluteAxis) -> Result<RawAbsInfo, Error>

Source

pub fn event_bits_of_kind<T>( &self, ) -> Result<impl Iterator<Item = T> + FusedIterator, Error>
where T: EventCode,

Source

pub fn absolute_axis_event_bits( &self, ) -> Result<impl Iterator<Item = AbsoluteAxisBit> + FusedIterator, Error>

Source

pub fn event_bits( &self, ) -> Result<impl Iterator<Item = EventBit> + FusedIterator, Error>

Source

pub fn upload_force_feedback_effect( &self, effect: impl Into<RawForceFeedbackEffect>, ) -> Result<ForceFeedbackEffectId, Error>

Source

pub fn erase_force_feedback_effect( &self, id: ForceFeedbackEffectId, ) -> Result<(), Error>

Source

pub fn enable_force_feedback_effect( &self, effect_id: ForceFeedbackEffectId, cycle_count: i32, ) -> Result<(), Error>

Source

pub fn disable_force_feedback_effect( &self, effect_id: ForceFeedbackEffectId, ) -> Result<(), Error>

Source

pub fn grab(&self) -> Result<(), Error>

Grabs the device for exclusive access.

No one else will receive any events from it.

Source

pub fn release(&self) -> Result<(), Error>

Releases the device from exclusive access.

Source

pub fn emit<T>(&self, body: T) -> Result<(), Error>

Emits a given event just as if it was sent by the device itself.

Makes sense only when the device is not grabbed for exclusive access.

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

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.