pub enum Key {
Wildcard,
Number(u8),
}Expand description
The key number of the note. This is also sometimes referred to as the “pitch”.
Same as MIDI1 Key Number (60 == Middle C)
Variants§
Wildcard
The note can belong to any key.
Number(u8)
The note’s key number, in 0..127.
Same as MIDI1 Key Number (60 == Middle C)
Implementations§
Source§impl Key
impl Key
Sourcepub const fn number(&self) -> Option<u8>
pub const fn number(&self) -> Option<u8>
Return the key number if it exists, or return None if it is a wildcard (the note
can belong to any key).
Sourcepub const fn number_or_middle_c(&self) -> u8
pub const fn number_or_middle_c(&self) -> u8
Return the key number if it exists, or return Middle C (60) if it is a wildcard.
Sourcepub const fn is_wildcard(&self) -> bool
pub const fn is_wildcard(&self) -> bool
Returns true if this is a wildcard (the note can belong to any channel).
Trait Implementations§
impl Copy for Key
impl Eq for Key
Source§impl Ord for Key
impl Ord for Key
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Key
impl PartialOrd for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more