pub struct ScaleLockPlayer {
pub scale: PlayerScale,
pub policy: ScaleLockPolicy,
}Expand description
Applies a ScaleLockPolicy to incoming pitches against a PlayerScale.
Fields§
§scale: PlayerScaleThe scale to lock pitches onto.
policy: ScaleLockPolicyThe policy used to handle out-of-scale pitches.
Implementations§
Source§impl ScaleLockPlayer
impl ScaleLockPlayer
Sourcepub fn new(scale: PlayerScale, policy: ScaleLockPolicy) -> Self
pub fn new(scale: PlayerScale, policy: ScaleLockPolicy) -> Self
Constructs a scale-lock player from a PlayerScale and a policy.
Sourcepub fn from_scale(scale: Scale, policy: ScaleLockPolicy) -> Self
pub fn from_scale(scale: Scale, policy: ScaleLockPolicy) -> Self
Constructs a scale-lock player directly from a Scale and a policy.
Sourcepub fn process_pitch(&self, pitch: Pitch) -> Option<Pitch>
pub fn process_pitch(&self, pitch: Pitch) -> Option<Pitch>
Applies the policy to a single pitch, returning None when a
ScaleLockPolicy::Filter policy rejects it.
Sourcepub fn process_pitches(
&self,
pitches: impl IntoIterator<Item = Pitch>,
) -> Vec<Pitch>
pub fn process_pitches( &self, pitches: impl IntoIterator<Item = Pitch>, ) -> Vec<Pitch>
Applies the policy to a sequence of pitches, collecting the surviving results.
Trait Implementations§
Source§impl Clone for ScaleLockPlayer
impl Clone for ScaleLockPlayer
Source§fn clone(&self) -> ScaleLockPlayer
fn clone(&self) -> ScaleLockPlayer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScaleLockPlayer
impl Debug for ScaleLockPlayer
impl Eq for ScaleLockPlayer
Source§impl Hash for ScaleLockPlayer
impl Hash for ScaleLockPlayer
Source§impl PartialEq for ScaleLockPlayer
impl PartialEq for ScaleLockPlayer
impl StructuralPartialEq for ScaleLockPlayer
Auto Trait Implementations§
impl Freeze for ScaleLockPlayer
impl RefUnwindSafe for ScaleLockPlayer
impl Send for ScaleLockPlayer
impl Sync for ScaleLockPlayer
impl Unpin for ScaleLockPlayer
impl UnsafeUnpin for ScaleLockPlayer
impl UnwindSafe for ScaleLockPlayer
Blanket Implementations§
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
Mutably borrows from an owned value. Read more