#[repr(transparent)]pub struct Pitch<T = f64>(pub T);Expand description
The Pitch implementation is a generic wrapper used to represent a musical pitch. A
pitch is defined to be a perceptual property of sounds that enables one to define the
highness or lowness of a sound. In music, pitch is often associated with the
frequency of a sound wave, with higher frequencies corresponding to higher pitches.
Tuple Fields§
§0: TImplementations§
Source§impl<T> Pitch<T>where
T: RawPitch,
impl<T> Pitch<T>where
T: RawPitch,
Sourcepub const fn new(value: T) -> Pitch<T>
pub const fn new(value: T) -> Pitch<T>
returns a new instance of the Pitch wrapping the given value
Sourcepub fn init<F>(f: F) -> Pitch<T>where
F: FnOnce() -> T,
pub fn init<F>(f: F) -> Pitch<T>where
F: FnOnce() -> T,
initialize a new instance of the pitch using the result of the given function
Sourcepub const fn as_mut_ptr(&mut self) -> *mut T
pub const fn as_mut_ptr(&mut self) -> *mut T
returns a mutable pointer to the inner value
Sourcepub fn map<U, F>(self, f: F) -> Pitch<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> Pitch<U>where
F: FnOnce(T) -> U,
apply a function to the inner value and returns a new Pitch wrapping the result
Sourcepub fn apply_mut<F>(&mut self, f: F)
pub fn apply_mut<F>(&mut self, f: F)
applies the function onto a mutable reference of the inner value
Sourcepub const fn replace(&mut self, index: T) -> T
pub const fn replace(&mut self, index: T) -> T
replace the pitch with the given value, returning the previous state.
Sourcepub fn take(&mut self) -> Twhere
T: Default,
pub fn take(&mut self) -> Twhere
T: Default,
takes and returns the inner value, replacing it with the logical default
of the type T
Sourcepub const fn view(&self) -> Pitch<&T>
pub const fn view(&self) -> Pitch<&T>
returns a new instance containing a reference to the inner value
Trait Implementations§
Source§impl<'a, _A, _B, _C> Add<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Add<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Add<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Add<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Add<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Add<_B, Output = _C>,
impl<'a, _A, _B, _C> Add<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Add<_B, Output = _C>,
Source§impl<_A, _B> AddAssign<Pitch<_B>> for Pitch<_A>where
_A: AddAssign<_B>,
impl<_A, _B> AddAssign<Pitch<_B>> for Pitch<_A>where
_A: AddAssign<_B>,
Source§fn add_assign(&mut self, rhs: Pitch<_B>)
fn add_assign(&mut self, rhs: Pitch<_B>)
+= operation. Read moreSource§impl<'a, _A, _B, _C> BitAnd<&'a mut Pitch<_B>> for Pitch<_A>where
_A: BitAnd<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> BitAnd<&'a mut Pitch<_B>> for Pitch<_A>where
_A: BitAnd<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> BitAnd<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: BitAnd<_B, Output = _C>,
impl<'a, _A, _B, _C> BitAnd<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: BitAnd<_B, Output = _C>,
Source§impl<_A, _B> BitAndAssign<Pitch<_B>> for Pitch<_A>where
_A: BitAndAssign<_B>,
impl<_A, _B> BitAndAssign<Pitch<_B>> for Pitch<_A>where
_A: BitAndAssign<_B>,
Source§fn bitand_assign(&mut self, rhs: Pitch<_B>)
fn bitand_assign(&mut self, rhs: Pitch<_B>)
&= operation. Read moreSource§impl<'a, _A, _B, _C> BitOr<&'a mut Pitch<_B>> for Pitch<_A>where
_A: BitOr<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> BitOr<&'a mut Pitch<_B>> for Pitch<_A>where
_A: BitOr<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> BitOr<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: BitOr<_B, Output = _C>,
impl<'a, _A, _B, _C> BitOr<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: BitOr<_B, Output = _C>,
Source§impl<_A, _B> BitOrAssign<Pitch<_B>> for Pitch<_A>where
_A: BitOrAssign<_B>,
impl<_A, _B> BitOrAssign<Pitch<_B>> for Pitch<_A>where
_A: BitOrAssign<_B>,
Source§fn bitor_assign(&mut self, rhs: Pitch<_B>)
fn bitor_assign(&mut self, rhs: Pitch<_B>)
|= operation. Read moreSource§impl<'a, _A, _B, _C> BitXor<&'a mut Pitch<_B>> for Pitch<_A>where
_A: BitXor<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> BitXor<&'a mut Pitch<_B>> for Pitch<_A>where
_A: BitXor<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> BitXor<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: BitXor<_B, Output = _C>,
impl<'a, _A, _B, _C> BitXor<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: BitXor<_B, Output = _C>,
Source§impl<_A, _B> BitXorAssign<Pitch<_B>> for Pitch<_A>where
_A: BitXorAssign<_B>,
impl<_A, _B> BitXorAssign<Pitch<_B>> for Pitch<_A>where
_A: BitXorAssign<_B>,
Source§fn bitxor_assign(&mut self, rhs: Pitch<_B>)
fn bitxor_assign(&mut self, rhs: Pitch<_B>)
^= operation. Read moreSource§impl<T> BorrowMut<T> for Pitch<T>
impl<T> BorrowMut<T> for Pitch<T>
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<'a, _A, _B, _C> Div<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Div<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Div<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Div<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Div<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Div<_B, Output = _C>,
impl<'a, _A, _B, _C> Div<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Div<_B, Output = _C>,
Source§impl<_A, _B> DivAssign<Pitch<_B>> for Pitch<_A>where
_A: DivAssign<_B>,
impl<_A, _B> DivAssign<Pitch<_B>> for Pitch<_A>where
_A: DivAssign<_B>,
Source§fn div_assign(&mut self, rhs: Pitch<_B>)
fn div_assign(&mut self, rhs: Pitch<_B>)
/= operation. Read moreSource§impl<'a, _A, _B, _C> Mul<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Mul<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Mul<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Mul<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Mul<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Mul<_B, Output = _C>,
impl<'a, _A, _B, _C> Mul<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Mul<_B, Output = _C>,
Source§impl<_A, _B> MulAssign<Pitch<_B>> for Pitch<_A>where
_A: MulAssign<_B>,
impl<_A, _B> MulAssign<Pitch<_B>> for Pitch<_A>where
_A: MulAssign<_B>,
Source§fn mul_assign(&mut self, rhs: Pitch<_B>)
fn mul_assign(&mut self, rhs: Pitch<_B>)
*= operation. Read moreSource§impl<T, E> Num for Pitch<T>
impl<T, E> Num for Pitch<T>
type FromStrRadixErr = <T as Num>::FromStrRadixErr
Source§impl<T> Ord for Pitch<T>where
T: Ord,
impl<T> Ord for Pitch<T>where
T: Ord,
Source§impl<T> PartialOrd<T> for Pitch<T>where
T: PartialOrd,
impl<T> PartialOrd<T> for Pitch<T>where
T: PartialOrd,
Source§impl<T> PartialOrd for Pitch<T>where
T: PartialOrd,
impl<T> PartialOrd for Pitch<T>where
T: PartialOrd,
Source§impl<'a, _A, _B, _C> Rem<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Rem<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Rem<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Rem<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Rem<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Rem<_B, Output = _C>,
impl<'a, _A, _B, _C> Rem<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Rem<_B, Output = _C>,
Source§impl<_A, _B> RemAssign<Pitch<_B>> for Pitch<_A>where
_A: RemAssign<_B>,
impl<_A, _B> RemAssign<Pitch<_B>> for Pitch<_A>where
_A: RemAssign<_B>,
Source§fn rem_assign(&mut self, rhs: Pitch<_B>)
fn rem_assign(&mut self, rhs: Pitch<_B>)
%= operation. Read moreSource§impl<'a, _A, _B, _C> Shl<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Shl<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Shl<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Shl<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Shl<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Shl<_B, Output = _C>,
impl<'a, _A, _B, _C> Shl<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Shl<_B, Output = _C>,
Source§impl<_A, _B> ShlAssign<Pitch<_B>> for Pitch<_A>where
_A: ShlAssign<_B>,
impl<_A, _B> ShlAssign<Pitch<_B>> for Pitch<_A>where
_A: ShlAssign<_B>,
Source§fn shl_assign(&mut self, rhs: Pitch<_B>)
fn shl_assign(&mut self, rhs: Pitch<_B>)
<<= operation. Read moreSource§impl<'a, _A, _B, _C> Shr<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Shr<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Shr<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Shr<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Shr<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Shr<_B, Output = _C>,
impl<'a, _A, _B, _C> Shr<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Shr<_B, Output = _C>,
Source§impl<_A, _B> ShrAssign<Pitch<_B>> for Pitch<_A>where
_A: ShrAssign<_B>,
impl<_A, _B> ShrAssign<Pitch<_B>> for Pitch<_A>where
_A: ShrAssign<_B>,
Source§fn shr_assign(&mut self, rhs: Pitch<_B>)
fn shr_assign(&mut self, rhs: Pitch<_B>)
>>= operation. Read moreSource§impl<'a, _A, _B, _C> Sub<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Sub<&'a mut _B, Output = _C>,
impl<'a, _A, _B, _C> Sub<&'a mut Pitch<_B>> for Pitch<_A>where
_A: Sub<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Sub<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Sub<_B, Output = _C>,
impl<'a, _A, _B, _C> Sub<Pitch<_B>> for &'a mut Pitch<_A>where
&'a mut _A: Sub<_B, Output = _C>,
Source§impl<_A, _B> SubAssign<Pitch<_B>> for Pitch<_A>where
_A: SubAssign<_B>,
impl<_A, _B> SubAssign<Pitch<_B>> for Pitch<_A>where
_A: SubAssign<_B>,
Source§fn sub_assign(&mut self, rhs: Pitch<_B>)
fn sub_assign(&mut self, rhs: Pitch<_B>)
-= operation. Read moreimpl<T> Copy for Pitch<T>where
T: Copy,
impl<T> Eq for Pitch<T>where
T: Eq,
impl<T> StructuralPartialEq for Pitch<T>
Auto Trait Implementations§
impl<T> Freeze for Pitch<T>where
T: Freeze,
impl<T> RefUnwindSafe for Pitch<T>where
T: RefUnwindSafe,
impl<T> Send for Pitch<T>where
T: Send,
impl<T> Sync for Pitch<T>where
T: Sync,
impl<T> Unpin for Pitch<T>where
T: Unpin,
impl<T> UnwindSafe for Pitch<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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