Note

Struct Note 

Source
pub struct Note { /* private fields */ }

Implementations§

Source§

impl Note

Source

pub fn new(class: usize, Octave: Octave) -> Self

Source

pub fn from_pitch(pitch: usize) -> Self

returns a new note from a pitch value

Source

pub const fn class(&self) -> usize

returns a copy to the index of the note’s class

Source

pub fn class_mut(&mut self) -> &mut usize

returns a mutable reference to the index of the note’s class

Source

pub const fn octave(&self) -> Octave

returns a copy to the octave of the note

Source

pub fn octave_mut(&mut self) -> &mut Octave

returns a mutable reference to the current octave

Source

pub fn set_class(&mut self, class: usize)

set the pitch class of the note

Source

pub fn set_octave(&mut self, octave: Octave)

set the octave of the note

Source

pub fn with_class(self, class: usize) -> Self

consumes the current instance to create another with the given pitch class

Source

pub fn with_octave(self, octave: Octave) -> Self

consumes the current instance to create another with the given octave

Trait Implementations§

Source§

impl Add<usize> for Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

fn add(self, rhs: usize) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Note) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<usize> for Note

Source§

fn add_assign(&mut self, rhs: usize)

Performs the += operation. Read more
Source§

impl AddAssign for Note

Source§

fn add_assign(&mut self, rhs: Note)

Performs the += operation. Read more
Source§

impl Clone for Note

Source§

fn clone(&self) -> Note

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Note

Source§

fn default() -> Note

Returns the “default value” for a type. Read more
Source§

impl Display for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<(i128, Octave)> for Note

Source§

fn from((class, octave): (i128, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, Octave)> for Note

Source§

fn from((class, octave): (i16, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, Octave)> for Note

Source§

fn from((class, octave): (i32, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, Octave)> for Note

Source§

fn from((class, octave): (i64, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, Octave)> for Note

Source§

fn from((class, octave): (i8, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(isize, Octave)> for Note

Source§

fn from((class, octave): (isize, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, Octave)> for Note

Source§

fn from((class, octave): (u128, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, Octave)> for Note

Source§

fn from((class, octave): (u16, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, Octave)> for Note

Source§

fn from((class, octave): (u32, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, Octave)> for Note

Source§

fn from((class, octave): (u64, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, Octave)> for Note

Source§

fn from((class, octave): (u8, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, Octave)> for Note

Source§

fn from((class, octave): (usize, Octave)) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Note

Source§

fn from(class: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Note

Source§

fn from(class: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Note

Source§

fn from(class: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Note

Source§

fn from(class: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Note

Source§

fn from(class: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Note

Source§

fn from(class: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Note

Source§

fn from(class: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Note

Source§

fn from(class: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Note

Source§

fn from(class: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Note

Source§

fn from(class: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Note

Source§

fn from(class: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Note

Source§

fn from(class: usize) -> Self

Converts to this type from the input type.
Source§

impl Hash for Note

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Note

Source§

fn cmp(&self, other: &Note) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Note

Source§

fn eq(&self, other: &Note) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Note

Source§

fn partial_cmp(&self, other: &Note) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub<usize> for Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: usize) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<usize> for Note

Source§

fn sub_assign(&mut self, rhs: usize)

Performs the -= operation. Read more
Source§

impl Copy for Note

Source§

impl Eq for Note

Source§

impl StructuralPartialEq for Note

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Send for Note

§

impl Sync for Note

§

impl Unpin for Note

§

impl UnwindSafe for Note

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Idx, T> IntoIndex<Idx> for T
where T: Into<Index<Idx>>,

Source§

fn into_index(self) -> Index<Idx>

Source§

impl<T> IntoNote for T
where T: Into<Note>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.