pub enum Rate {
Fixed(f32),
Linear(f32, f32, usize),
Exponential(f32, f32, usize),
Cyclical(f32, f32, usize, CycleShape),
Stepwise(Vec<(usize, f32)>),
}Expand description
Rate enum representing different types of rate schedules where each variant defines a method to compute the rate value at a given step. These are designed to produce values within the range [0.0, 1.0] - ie: a rate.
Variants§
Fixed(f32)
Linear(f32, f32, usize)
A linear rate that changes from start to end over a number of steps.
§Parameters
start: The starting rate value.end: The ending rate value.steps: The number of steps over which to change the rate.
Exponential(f32, f32, usize)
An exponential rate that changes from start to end over a half-life period.
§Parameters
start: The starting rate value.end: The ending rate value.half_life: The half-life period over which to change the rate.
Cyclical(f32, f32, usize, CycleShape)
A cyclical rate that oscillates between min and max over a period.
§Parameters
min: The minimum rate value.max: The maximum rate value.period: The period over which to cycle the rate.shape: The shape of the cycle (Triangle or Sine).
Stepwise(Vec<(usize, f32)>)
Piecewise-constant schedule: at each listed step, rate jumps to the given value. The value remains constant until the next listed step. The first step must be 0. If the current step is beyond the last listed step, the rate remains at the last value.
§Parameters
Vec<(usize, f32)>: A vector of (step, rate) pairs.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Rate
Auto Trait Implementations§
impl Freeze for Rate
impl RefUnwindSafe for Rate
impl Send for Rate
impl Sync for Rate
impl Unpin for Rate
impl UnsafeUnpin for Rate
impl UnwindSafe for Rate
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