pub struct Dualsense { /* private fields */ }Expand description
Interface used to interact with a Dualsense controller; encapsulates a hidapi::HidDevice and a buffer to be re-used when reading input reports from the hid device.
Implementations§
Source§impl Dualsense
impl Dualsense
Sourcepub fn new(hid_api: &mut HidApi) -> HidResult<Dualsense>
pub fn new(hid_api: &mut HidApi) -> HidResult<Dualsense>
Creates a new Dualsense instance; will error if no device is connected to the USB port.
Sourcepub fn read_into(&mut self, state: &mut DualsenseState) -> HidResult<()>
pub fn read_into(&mut self, state: &mut DualsenseState) -> HidResult<()>
Reads an input report from the device into a provided mutable reference to a gamepad state.
Sourcepub fn read(&mut self) -> HidResult<DualsenseState>
pub fn read(&mut self) -> HidResult<DualsenseState>
Reads an input report from the device and returns a gamepad state.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Dualsense
impl !Sync for Dualsense
impl !UnwindSafe for Dualsense
impl Freeze for Dualsense
impl Send for Dualsense
impl Unpin for Dualsense
impl UnsafeUnpin for Dualsense
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