Struct Note

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

Implementations§

Source§

impl Note

Source

pub fn new(octave: Octave, pitch: impl IntoPitch) -> Self

Source

pub fn from_pitch(pitch: impl IntoPitch) -> Self

Returns a new instance of the note with the given pitch; the note’s octave is set to the default octave (4).

Source

pub fn class(&self) -> Pitches

Returns an instance of the note’s PitchClass. Each pitch class is a synmoblic representation of a group of frequencies, which are separated by a factor of 2^(1/12).

Source

pub const fn octave(&self) -> &Octave

Returns an owned instance of the note’s octave

Source

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

Returns a mutable reference to the note’s octave

Source

pub const fn pitch(&self) -> &Pitch

Returns an owned instance of the note’s pitch

Source

pub fn pitch_mut(&mut self) -> &mut Pitch

Returns a mutable reference to the note’s pitch

Source

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

Sets the note’s octave

Source

pub fn set_pitch(&mut self, Pitch: Pitch)

Sets the note’s pitch

Source

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

Returns a new instance of the note with the given octave

Source

pub fn with_pitch(self, Pitch: Pitch) -> Note

Returns a new instance of the note with the given pitch

Trait Implementations§

Source§

impl<'a> Add<&'a Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> Add<&'a Note> for Intervals

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> Add<&'a Note> for Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> Add<Intervals> for &'a Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Intervals> for Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> Add<Note> for &'a Intervals

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<'a> Add<Note> for &'a 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 Add<Note> for Intervals

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<'a> Add for &'a Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a Note) -> 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<Intervals> for Note

Source§

fn add_assign(&mut self, rhs: Intervals)

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 copy 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<'de> Deserialize<'de> for Note

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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<'a> Div<&'a Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Note) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<&'a Note> for Intervals

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Note) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<&'a Note> for Note

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Note) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<Intervals> for &'a Note

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Intervals) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<Intervals> for Note

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Intervals) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a> Div<Note> for &'a Note

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Note> for Intervals

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a> Div for &'a Note

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Note) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for Note

Source§

type Output = Note

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl DivAssign<Intervals> for Note

Source§

fn div_assign(&mut self, rhs: Intervals)

Performs the /= operation. Read more
Source§

impl DivAssign for Note

Source§

fn div_assign(&mut self, rhs: Note)

Performs the /= operation. Read more
Source§

impl From<(Octave, Pitch)> for Note

Source§

fn from((octave, pitch): (Octave, Pitch)) -> Self

Converts to this type from the input type.
Source§

impl From<Note> for (Octave, Pitch)

Source§

fn from(note: Note) -> Self

Converts to this type from the input type.
Source§

impl From<Note> for Pitch

Source§

fn from(note: Note) -> Self

Converts to this type from the input type.
Source§

impl From<Pitch> for Note

Source§

fn from(pitch: Pitch) -> 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 IntervalOps for Note

Source§

type Output = Note

Source§

fn add_interval<I: IntoInterval>(&self, interval: I) -> Self::Output

Add an interval to the given object
Source§

fn sub_interval<I: IntoInterval>(&self, interval: I) -> Self::Output

Subtract an interval from the given object
Source§

fn add_semitone(&self) -> Self::Output

Source§

fn sub_semitone(&self) -> Self::Output

Source§

fn add_tone(&self) -> Self::Output

Source§

fn sub_tone(&self) -> Self::Output

Source§

fn add_major_third(&self) -> Self::Output

Source§

fn sub_major_third(&self) -> Self::Output

Source§

fn add_minor_third(&self) -> Self::Output

Source§

fn sub_minor_third(&self) -> Self::Output

Source§

fn add_perfect_fifth(&self) -> Self::Output

Source§

fn sub_perfect_fifth(&self) -> Self::Output

Source§

fn add_augmented_fifth(&self) -> Self::Output

Source§

fn sub_augmented_fifth(&self) -> Self::Output

Source§

fn add_diminished_fifth(&self) -> Self::Output

Source§

fn sub_diminished_fifth(&self) -> Self::Output

Source§

fn add_augmented_seventh(&self) -> Self::Output

Source§

fn sub_augmented_seventh(&self) -> Self::Output

Source§

fn add_diminished_seventh(&self) -> Self::Output

Source§

fn sub_diminished_seventh(&self) -> Self::Output

Source§

fn add_major_seventh(&self) -> Self::Output

Source§

fn sub_major_seventh(&self) -> Self::Output

Source§

fn add_minor_seventh(&self) -> Self::Output

Source§

fn sub_minor_seventh(&self) -> Self::Output

Source§

fn add_octave(&self) -> Self::Output

Source§

fn sub_octave(&self) -> Self::Output

Source§

impl<'a> Mul<&'a Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Note) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Note> for Intervals

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Note) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Note> for Note

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Note) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Intervals> for &'a Note

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Intervals) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Intervals> for Note

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Intervals) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> Mul<Note> for &'a Note

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Note> for Intervals

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> Mul for &'a Note

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Note) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for Note

Source§

type Output = Note

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign<Intervals> for Note

Source§

fn mul_assign(&mut self, rhs: Intervals)

Performs the *= operation. Read more
Source§

impl MulAssign for Note

Source§

fn mul_assign(&mut self, rhs: Note)

Performs the *= operation. Read more
Source§

impl Notable for Note

Source§

fn pitch(&self) -> Pitch

Find the modular index of the given pitch
Source§

fn pitch_class(&self) -> Pitches

Classify the pitch into a pitch class
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<'a> Rem<&'a Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Note) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<&'a Note> for Intervals

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Note) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<&'a Note> for Note

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Note) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<Intervals> for &'a Note

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Intervals) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Intervals> for Note

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Intervals) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<'a> Rem<Note> for &'a Note

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl Rem<Note> for Intervals

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<'a> Rem for &'a Note

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Note) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for Note

Source§

type Output = Note

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl RemAssign<Intervals> for Note

Source§

fn rem_assign(&mut self, rhs: Intervals)

Performs the %= operation. Read more
Source§

impl RemAssign for Note

Source§

fn rem_assign(&mut self, rhs: Note)

Performs the %= operation. Read more
Source§

impl Serialize for Note

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Sub<&'a Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Note) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a Note> for Intervals

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Note) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a Note> for Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Note) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<Intervals> for &'a Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Intervals> for Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sub<Note> for &'a Intervals

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sub<Note> for &'a Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Note> for Intervals

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sub for &'a Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Note) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign<Intervals> for Note

Source§

fn sub_assign(&mut self, rhs: Intervals)

Performs the -= operation. Read more
Source§

impl SubAssign for Note

Source§

fn sub_assign(&mut self, rhs: Note)

Performs the -= operation. Read more
Source§

impl Copy for Note

Source§

impl Eq for Note

Source§

impl Send for Note

Source§

impl StructuralPartialEq for Note

Source§

impl Sync for Note

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Unpin for Note

§

impl UnwindSafe for Note

Blanket Implementations§

Source§

impl<A, B, C> AbsMod<B> for A
where A: Add<C, Output = C> + Copy + Rem<B, Output = C>, B: Copy, C: Add<B, Output = C> + Rem<B, Output = C> + Signed,

Source§

type Output = C

Source§

fn absmod(&self, rhs: B) -> <A as AbsMod<B>>::Output

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<I> IntoInterval for I
where I: Into<Intervals>,

Source§

impl<S> IntoPitch for S
where S: Into<Pitch>,

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,