pub struct Scheduler<W> {
pub budget_warnings: u64,
/* private fields */
}Expand description
The frame scheduler: runs registered systems in order, tracks frame time.
Fields§
§budget_warnings: u64How many times the sustained-overrun warning has fired. Read by tests and the observability cross-cut (book T15).
Implementations§
Source§impl<W> Scheduler<W>
impl<W> Scheduler<W>
pub fn new() -> Self
Sourcepub fn with_budget_ns(budget_ns: u64) -> Self
pub fn with_budget_ns(budget_ns: u64) -> Self
Build a scheduler graded against a specific frame budget (ns).
pub fn add_system(&mut self, s: Box<dyn System<W>>)
Sourcepub fn system_timings(&self) -> &[(String, f32)]
pub fn system_timings(&self) -> &[(String, f32)]
Per-system wall time of the last frame, in run order:
[(name, ms), ...]. Updated by every Scheduler::tick.
Sourcepub fn tick(&mut self, world: &mut W) -> f32
pub fn tick(&mut self, world: &mut W) -> f32
Run one frame. Returns the measured frame time in ms.
Sourcepub fn avg_frame_ms(&self) -> f32
pub fn avg_frame_ms(&self) -> f32
Mean frame time over the last 60 frames, in ms.
Trait Implementations§
Auto Trait Implementations§
impl<W> !RefUnwindSafe for Scheduler<W>
impl<W> !Send for Scheduler<W>
impl<W> !Sync for Scheduler<W>
impl<W> !UnwindSafe for Scheduler<W>
impl<W> Freeze for Scheduler<W>
impl<W> Unpin for Scheduler<W>
impl<W> UnsafeUnpin for Scheduler<W>
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