Skip to main content

UiAction

Enum UiAction 

Source
pub enum UiAction {
    Up,
    Down,
    Left,
    Right,
    Confirm,
    Cancel,
    Debug,
}
Expand description

What the generic widgets (a menu), the Key bindings screen and the debug hook react to. A game maps some of its actions onto these with ActionSet::ui; the rest are its own business.

Variants§

§

Up

Move up (a menu’s focus, a cursor).

§

Down

Move down.

§

Left

Move left.

§

Right

Move right.

§

Confirm

Confirm / select.

§

Cancel

Cancel / back.

§

Debug

Open the developer’s debug screens.

Trait Implementations§

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).

Source§

type Group = ()

No two actions share a key.

Source§

fn is_repeatable(self) -> bool

The four moves repeat while held.

Source§

fn is_required(self) -> bool

The six must keep a key: the game can’t be played without one.

Source§

const ALL: &'static [UiAction]

Every action, in the order the game lists them (the order a repair of the saved bindings keeps the first of two claims in).
Source§

fn name(self) -> &'static str

The name used in keymap files and the saved bindings.
Source§

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.
Source§

fn group(self)

Its Group.
Source§

fn ui(self) -> Option<UiAction>

What a generic widget or screen takes it for, if anything.
Source§

fn fixed_keys() -> &'static [(Chord, UiAction)]

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 &[].
Source§

fn from_name(name: &str) -> Option<Self>

Looks an action up by its name (exact match).
Source§

fn for_ui(ui: UiAction) -> Option<Self>

The first action that ui maps to ui, if any.
Source§

impl Clone for UiAction

Source§

fn clone(&self) -> UiAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UiAction

Source§

impl Debug for UiAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for UiAction

Source§

impl Hash for UiAction

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for UiAction

Source§

fn cmp(&self, other: &UiAction) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for UiAction

Source§

fn eq(&self, other: &UiAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for UiAction

Source§

fn partial_cmp(&self, other: &UiAction) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for UiAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<A> ActionIds for A
where A: ActionSet,

Source§

fn id(self) -> ActionId

Its id: its place in ActionSet::ALL, from 0 (u16::MAX for an action that isn’t there, or past it).
Source§

fn from_id(id: ActionId) -> Option<A>

The action whose id is id, if there is one.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.