Skip to main content

InputAction

Trait InputAction 

Source
pub trait InputAction: Copy + 'static {
    type Binding: Persisted + Display;

    // Required methods
    fn defaults(&self) -> Vec<Self::Binding>;
    fn all() -> Vec<Self>;
    fn name(&self) -> &'static str;
    fn from_name(name: &str) -> Option<Self>;
}
Expand description

Trait every action vocabulary implements, written by InputButtonAction, InputAxisAction and InputAxis2Action.

Required if you want to rebind or read an action generically; the kind traits are what a game implements by hand.

Required Associated Types§

Source

type Binding: Persisted + Display

Binding type for an action of this kind, which is what makes a mis-kinded rebind fail to compile.

Required Methods§

Source

fn defaults(&self) -> Vec<Self::Binding>

Default controls this action is bound to, before a player changes anything.

Source

fn all() -> Vec<Self>

Every action of this vocabulary, which startup materializes into the table a player rebinds; one this leaves out reads through nothing.

Source

fn name(&self) -> &'static str

Name this action is known by in code; also the name the store keeps a rebind under.

Source

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

The action of this name, or None where the vocabulary has none.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§