pub struct PadReader { /* private fields */ }Expand description
A port reader that never hands a garbled packet to the game.
A poll that fails validation reports PadMode::Unknown with every
button released. Taken at face value, a held button would read as released
for that one frame and then as a fresh press on the next, so a held Select
or Cross fires twice. The reader returns the last clean state instead.
A clean report of an empty port is accepted as it is: unplugging a pad
does release its buttons.
Implementations§
Source§impl PadReader
impl PadReader
Sourcepub fn poll_on<T: Transport>(&mut self, port: &mut T) -> PadState
pub fn poll_on<T: Transport>(&mut self, port: &mut T) -> PadState
Poll the port once and return the latest clean state.
Sourcepub fn poll(&mut self) -> PadState
👎Deprecated: use poll_on with the ControllerPort token
pub fn poll(&mut self) -> PadState
use poll_on with the ControllerPort token
Poll the port once and return the latest clean state.
Sourcepub fn accept(&mut self, state: PadState) -> PadState
pub fn accept(&mut self, state: PadState) -> PadState
Fold one poll result into the reader and return the latest clean
state. PadReader::poll_on calls this; it is public so a caller that
polls some other way gets the same rule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PadReader
impl RefUnwindSafe for PadReader
impl Send for PadReader
impl Sync for PadReader
impl Unpin for PadReader
impl UnsafeUnpin for PadReader
impl UnwindSafe for PadReader
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)