pub struct Schedule { /* private fields */ }Expand description
An ordered schedule: entries strictly increasing by planned_start.
This crate does not sort entries for you — Schedule::push rejects an
out-of-order entry immediately, so a caller building a schedule sees
ordering mistakes at construction time rather than as a silently
misordered playout later.
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub fn push(&mut self, entry: ScheduleEntry) -> Result<()>
pub fn push(&mut self, entry: ScheduleEntry) -> Result<()>
Append entry. Errors with Error::OutOfOrder if entry does not
start strictly after the schedule’s current last entry.
Sourcepub fn entries(&self) -> &[ScheduleEntry]
pub fn entries(&self) -> &[ScheduleEntry]
The entries, in schedule order.
Sourcepub fn active_at(&self, pts: u64) -> Option<&ScheduleEntry>
pub fn active_at(&self, pts: u64) -> Option<&ScheduleEntry>
The entry active at pts — the last entry whose planned_start <= pts — or None if pts precedes every entry (or the schedule is
empty).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schedule
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Schedule
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Schedule
impl StructuralPartialEq for Schedule
Auto Trait Implementations§
impl Freeze for Schedule
impl RefUnwindSafe for Schedule
impl Send for Schedule
impl Sync for Schedule
impl Unpin for Schedule
impl UnsafeUnpin for Schedule
impl UnwindSafe for Schedule
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