Struct gilrs_core::Gilrs
source · pub struct Gilrs {
pub(crate) inner: Gilrs,
}
Expand description
Struct used to manage gamepads and retrieve events.
Fields§
§inner: Gilrs
Implementations§
source§impl Gilrs
impl Gilrs
pub fn new() -> Result<Self, Error>
sourcepub fn next_event(&mut self) -> Option<Event>
pub fn next_event(&mut self) -> Option<Event>
Returns oldest event or None
if all events were processed.
sourcepub fn next_event_blocking(
&mut self,
timeout: Option<Duration>,
) -> Option<Event>
pub fn next_event_blocking( &mut self, timeout: Option<Duration>, ) -> Option<Event>
Returns oldest event, waiting for new event if necessary.
sourcepub fn gamepad(&self, id: usize) -> Option<&Gamepad>
pub fn gamepad(&self, id: usize) -> Option<&Gamepad>
Borrows Gamepad
or return None
if index is invalid. Returned gamepad may be disconnected.
sourcepub fn last_gamepad_hint(&self) -> usize
pub fn last_gamepad_hint(&self) -> usize
Returns id greater than id of last connected gamepad. The returned value is only hint and may be much larger than number of observed gamepads. For example, it may return maximum number of connected gamepads on platforms when this limit is small.
gamepad(id)
should return Some
if using id that is smaller than value returned from this
function.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Gilrs
impl RefUnwindSafe for Gilrs
impl Send for Gilrs
impl !Sync for Gilrs
impl Unpin for Gilrs
impl UnwindSafe for Gilrs
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more