[][src]Struct piano_keyboard::Keyboard2d

pub struct Keyboard2d {
    pub left_white_key: u8,
    pub right_white_key: u8,
    pub width: u16,
    pub height: u16,
    // some fields omitted
}

The returned 2d Keyboard with all calculated elements.

Fields

left_white_key: u8right_white_key: u8width: u16height: u16

Methods

impl Keyboard2d[src]

pub fn iter(&self) -> Iter<Element>[src]

This function is the preferred way to iterate through all elements. The sequence is from left to right alternating keys in order: white,black,white,....,black,white

pub fn white_keys(&self, blind_as_white: bool) -> Vec<Rectangle>[src]

This function allows to retrieve all white key rectangles - with or without blind.

pub fn black_keys(&self) -> Vec<Rectangle>[src]

This function allows to retrieve all black key rectangles.

pub fn is_perfect(&self) -> bool[src]

Is true for a keyboard without compromises on width/gaps. For example: cargo run --example make_png -- --width 811

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.