pub trait ActionSet:
Copy
+ Ord
+ Eq
+ Hash
+ Debug
+ 'static {
type Group: Copy + Ord + Eq + Debug;
const ALL: &'static [Self];
// Required methods
fn name(self) -> &'static str;
fn is_repeatable(self) -> bool;
fn is_required(self) -> bool;
fn is_rebindable(self) -> bool;
fn group(self) -> Self::Group;
fn ui(self) -> Option<UiAction>;
fn fixed_keys() -> &'static [(Chord, Self)];
// Provided methods
fn from_name(name: &str) -> Option<Self> { ... }
fn for_ui(ui: UiAction) -> Option<Self> { ... }
}Expand description
Everything a player can ask for in one game: the game’s action enum. The keymap file, the keymap, held keys and repeat, the player’s saved bindings and help text are all built on it, never on one game’s actions.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn is_repeatable(self) -> bool
fn is_repeatable(self) -> bool
Whether holding its key or button re-emits it.
Sourcefn is_required(self) -> bool
fn is_required(self) -> bool
Whether the player must always keep at least one key (and one button) on it.
Sourcefn is_rebindable(self) -> bool
fn is_rebindable(self) -> bool
Whether the player can rebind it. One that can’t keeps the keymap file’s keys and has no controller button.
Sourcefn fixed_keys() -> &'static [(Chord, Self)]
fn fixed_keys() -> &'static [(Chord, Self)]
The keys every keymap has on top of its own bindings, which the
player can’t move or remove (this game: plain Escape cancels).
Shown after an action’s own keys in help text, but never counted as
a key of its own. A game with none returns &[].
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl ActionSet for UiAction
The ready-made action set of a game that plays with the six moves: its
keymap file names Up, Down, Left, Right, Confirm and Cancel,
every one required and rebindable. UiAction::Debug is no action of
the set: a game with a debug key writes its own action enum. A
UiAction added later stays out of ALL too, so no
game’s keymap file must name it (ADR-0036).
impl ActionSet for UiAction
The ready-made action set of a game that plays with the six moves: its
keymap file names Up, Down, Left, Right, Confirm and Cancel,
every one required and rebindable. UiAction::Debug is no action of
the set: a game with a debug key writes its own action enum. A
UiAction added later stays out of ALL too, so no
game’s keymap file must name it (ADR-0036).