pub struct ActionMap<const ACTIONS: usize> { /* private fields */ }Expand description
Fixed, allocation-free mapping from game-defined action indices to pads.
Implementations§
Source§impl<const ACTIONS: usize> ActionMap<ACTIONS>
impl<const ACTIONS: usize> ActionMap<ACTIONS>
Sourcepub const fn new(bindings: [ActionBinding; ACTIONS]) -> Self
pub const fn new(bindings: [ActionBinding; ACTIONS]) -> Self
Construct a map in the same order as the game’s action enum.
Sourcepub const fn bindings(&self) -> &[ActionBinding; ACTIONS]
pub const fn bindings(&self) -> &[ActionBinding; ACTIONS]
Read the complete binding table.
Sourcepub fn set(&mut self, action: usize, binding: ActionBinding)
pub fn set(&mut self, action: usize, binding: ActionBinding)
Replace one binding. Out-of-range indices are ignored.
Sourcepub const fn binding(&self, action: usize) -> ActionBinding
pub const fn binding(&self, action: usize) -> ActionBinding
Read one binding, returning ActionBinding::UNBOUND out of range.
Sourcepub const fn input<'a>(
&'a self,
current: PadState,
previous: PadState,
) -> ActionInput<'a, ACTIONS>
pub const fn input<'a>( &'a self, current: PadState, previous: PadState, ) -> ActionInput<'a, ACTIONS>
Interpret current and previous pad states through this map.
Trait Implementations§
impl<const ACTIONS: usize> Copy for ActionMap<ACTIONS>
impl<const ACTIONS: usize> Eq for ActionMap<ACTIONS>
impl<const ACTIONS: usize> StructuralPartialEq for ActionMap<ACTIONS>
Auto Trait Implementations§
impl<const ACTIONS: usize> Freeze for ActionMap<ACTIONS>
impl<const ACTIONS: usize> RefUnwindSafe for ActionMap<ACTIONS>
impl<const ACTIONS: usize> Send for ActionMap<ACTIONS>
impl<const ACTIONS: usize> Sync for ActionMap<ACTIONS>
impl<const ACTIONS: usize> Unpin for ActionMap<ACTIONS>
impl<const ACTIONS: usize> UnsafeUnpin for ActionMap<ACTIONS>
impl<const ACTIONS: usize> UnwindSafe for ActionMap<ACTIONS>
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
Mutably borrows from an owned value. Read more
§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)
🔬This is a nightly-only experimental API. (
clone_to_uninit)