pub struct TicklessSchedule<C, T: UnitValue = u8> { /* private fields */ }Expand description
A tickless schedule bound to a monotonic curve and segment parameters.
C is the curve type and T is the curve’s normalised value type
(e.g. u8). Use Tickless::tickless_schedule to construct one
fluently, or build it directly with TicklessSchedule::new.
Implementations§
Source§impl<C, T> TicklessSchedule<C, T>where
C: MonotonicCurve<T, T>,
T: UnitValue,
impl<C, T> TicklessSchedule<C, T>where
C: MonotonicCurve<T, T>,
T: UnitValue,
Sourcepub fn new(
curve: C,
t0_ms: u32,
duration_ms: u32,
start_val: u16,
end_val: u16,
step: u16,
rounding: Rounding,
min_dt_ms: u32,
) -> Self
pub fn new( curve: C, t0_ms: u32, duration_ms: u32, start_val: u16, end_val: u16, step: u16, rounding: Rounding, min_dt_ms: u32, ) -> Self
Create a new tickless schedule.
§Parameters
curve— the monotonic curve that shapes the transition.t0_ms— wall-clock start time of the segment in milliseconds.duration_ms— total duration of the segment in milliseconds.start_val— raw output value att = 0(before quantization).end_val— raw output value att = 1(before quantization).step— quantization step size (clamped to a minimum of 1).rounding— how values are snapped to the quantization grid.min_dt_ms— minimum time between successive deadlines. Useful for rate-limiting hardware updates. Set to0for no limit.
Sourcepub fn with_repeat(self, mode: RepeatMode) -> Self
pub fn with_repeat(self, mode: RepeatMode) -> Self
Set the repeat mode, consuming and returning self for chaining.
Sourcepub fn next_deadline(&self, now_ms: u32) -> TicklessDeadline
pub fn next_deadline(&self, now_ms: u32) -> TicklessDeadline
Compute the next deadline after now_ms.
Returns the quantized output value that should be applied now and the wall-clock time at which the next quantized transition will occur.
When now_ms is at or past the end of the segment, the returned
deadline is clamped to the segment end and the final quantized value.
Sourcepub fn iter(&self, now_ms: u32) -> TicklessIter<'_, C, T> ⓘ
pub fn iter(&self, now_ms: u32) -> TicklessIter<'_, C, T> ⓘ
Return an iterator that yields successive TicklessDeadline values
starting from now_ms, automatically advancing to each deadline.
For RepeatMode::Once the iterator finishes when the segment ends.
For RepeatMode::Repeat and RepeatMode::PingPong it cycles
indefinitely.
Trait Implementations§
Source§impl<C: Clone, T: Clone + UnitValue> Clone for TicklessSchedule<C, T>
impl<C: Clone, T: Clone + UnitValue> Clone for TicklessSchedule<C, T>
Source§fn clone(&self) -> TicklessSchedule<C, T>
fn clone(&self) -> TicklessSchedule<C, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more