KeyMapping

Trait KeyMapping 

Source
pub trait KeyMapping {
    // Required methods
    fn new(side: PlayerSide, kind: NoteKind, key: Key) -> Self;
    fn side(&self) -> PlayerSide;
    fn kind(&self) -> NoteKind;
    fn key(&self) -> Key;
    fn into_tuple(self) -> (PlayerSide, NoteKind, Key);

    // Provided method
    fn from_tuple((side, kind, key): (PlayerSide, NoteKind, Key)) -> Self
       where Self: Sized { ... }
}
Expand description

A trait for key mapping storage structure.

Required Methods§

Source

fn new(side: PlayerSide, kind: NoteKind, key: Key) -> Self

Create a new KeyMapping from a PlayerSide, NoteKind and Key.

Source

fn side(&self) -> PlayerSide

Get the PlayerSide from this KeyMapping.

Source

fn kind(&self) -> NoteKind

Get the NoteKind from this KeyMapping.

Source

fn key(&self) -> Key

Get the Key from this KeyMapping.

Source

fn into_tuple(self) -> (PlayerSide, NoteKind, Key)

Deconstruct into a PlayerSide, NoteKind, Key tuple.

Provided Methods§

Source

fn from_tuple((side, kind, key): (PlayerSide, NoteKind, Key)) -> Self
where Self: Sized,

Create a new KeyMapping from a tuple of PlayerSide, NoteKind and Key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§