[−][src]Struct lp_tetris::Pad
Represents a pad on the Launchpad Provides methods to convert to and from a note byte
Fields
x: u8
y: u8
Methods
impl Pad
[src]
pub fn note(&self) -> u8
[src]
Returns the MIDI note corresponding to the pad.
assert_eq!(Pad { x: 0, y: 0 }.note(), 11); assert_eq!(Pad { x: 7, y: 0 }.note(), 18); assert_eq!(Pad { x: 0, y: 7 }.note(), 81); assert_eq!(Pad { x: 7, y: 7 }.note(), 88);
This is the inverse of ::from_note
let pad = Pad { x: 3, y: 5 }; assert_eq!(pad, Pad::from_note(pad.note()));
pub fn from_note(note: u8) -> Pad
[src]
Returns a Pad corresponding to the given MIDI note.
assert_eq!(Pad { x: 0, y: 0 }, Pad::from_note(11)); assert_eq!(Pad { x: 7, y: 0 }, Pad::from_note(18)); assert_eq!(Pad { x: 0, y: 7 }, Pad::from_note(81)); assert_eq!(Pad { x: 7, y: 7 }, Pad::from_note(88));
This is the inverse of .note
let note = 0x22; assert_eq!(note, Pad::from_note(note).note());
Trait Implementations
impl Clone for Pad
[src]
impl Copy for Pad
[src]
impl Debug for Pad
[src]
impl PartialEq<Pad> for Pad
[src]
impl StructuralPartialEq for Pad
[src]
Auto Trait Implementations
impl RefUnwindSafe for Pad
impl Send for Pad
impl Sync for Pad
impl Unpin for Pad
impl UnwindSafe for Pad
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,