pub struct TimedSwitchValues<I> { /* private fields */ }
Expand description
Represents a switched value that changes over the course of a buffer.
Each point represents a change in value at a given sample offset - the value remains constant until the next point (or the end of the buffer)
Some invariants:
- There will always be at least one point
- The first point’s
sample_offset
will be 0 sample_offset
s will be monotonically increasing and only one point will appear for eachsample_offset
Implementations§
Source§impl<I: IntoIterator<Item = TimedValue<bool>> + Clone> TimedSwitchValues<I>
impl<I: IntoIterator<Item = TimedValue<bool>> + Clone> TimedSwitchValues<I>
Sourcepub fn new(points: I, buffer_size: usize) -> Option<Self>
pub fn new(points: I, buffer_size: usize) -> Option<Self>
Construct a new TimedSwitchValues
from an iterator of points.
This will check the invariants for the curve, and if any are invalid, this will
return None
.
§Examples
assert!(TimedSwitchValues::new(
vec![TimedValue { sample_offset: 0, value: false },
TimedValue { sample_offset: 100, value: true }],
128,
).is_some());
Source§impl<I> TimedSwitchValues<I>
impl<I> TimedSwitchValues<I>
Sourcepub fn buffer_size(&self) -> usize
pub fn buffer_size(&self) -> usize
Get the size of the buffer this curve is defined over.
Trait Implementations§
Source§impl<I: Clone> Clone for TimedSwitchValues<I>
impl<I: Clone> Clone for TimedSwitchValues<I>
Source§fn clone(&self) -> TimedSwitchValues<I>
fn clone(&self) -> TimedSwitchValues<I>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<I: IntoIterator<Item = TimedValue<bool>>> IntoIterator for TimedSwitchValues<I>
impl<I: IntoIterator<Item = TimedValue<bool>>> IntoIterator for TimedSwitchValues<I>
Auto Trait Implementations§
impl<I> Freeze for TimedSwitchValues<I>where
I: Freeze,
impl<I> RefUnwindSafe for TimedSwitchValues<I>where
I: RefUnwindSafe,
impl<I> Send for TimedSwitchValues<I>where
I: Send,
impl<I> Sync for TimedSwitchValues<I>where
I: Sync,
impl<I> Unpin for TimedSwitchValues<I>where
I: Unpin,
impl<I> UnwindSafe for TimedSwitchValues<I>where
I: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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