#[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) -> Self
pub const fn new(value: T) -> Self
returns a new instance of the Pitch wrapping the given value
Sourcepub fn init<F>(f: F) -> Selfwhere
F: FnOnce() -> T,
pub fn init<F>(f: F) -> Selfwhere
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§fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
2..=36). Read moreSource§impl<T: Ord> Ord for Pitch<T>
impl<T: Ord> Ord for Pitch<T>
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> PartialOrd for Pitch<T>
impl<T: PartialOrd> PartialOrd for Pitch<T>
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 more