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§
Sourcefn new(side: PlayerSide, kind: NoteKind, key: Key) -> Self
fn new(side: PlayerSide, kind: NoteKind, key: Key) -> Self
Create a new KeyMapping
from a PlayerSide
, NoteKind
and Key
.
Sourcefn side(&self) -> PlayerSide
fn side(&self) -> PlayerSide
Get the PlayerSide
from this KeyMapping
.
Sourcefn kind(&self) -> NoteKind
fn kind(&self) -> NoteKind
Get the NoteKind
from this KeyMapping
.
Sourcefn key(&self) -> Key
fn key(&self) -> Key
Get the Key
from this KeyMapping
.
Sourcefn into_tuple(self) -> (PlayerSide, NoteKind, Key)
fn into_tuple(self) -> (PlayerSide, NoteKind, Key)
Deconstruct into a PlayerSide
, NoteKind
, Key
tuple.
Provided Methods§
Sourcefn from_tuple((side, kind, key): (PlayerSide, NoteKind, Key)) -> Selfwhere
Self: Sized,
fn from_tuple((side, kind, key): (PlayerSide, NoteKind, Key)) -> Selfwhere
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.