pub struct Scheduler { /* private fields */ }Expand description
The scheduler manages the work queue and coordinates frame timing.
Implementations§
Source§impl Scheduler
impl Scheduler
pub fn new() -> Self
Sourcepub fn set_frame_budget(&mut self, budget: Duration)
pub fn set_frame_budget(&mut self, budget: Duration)
Set frame budget (e.g., 8.33ms for 120fps ProMotion displays).
Sourcepub fn enqueue(&self, batch: IrBatch, priority: Priority)
pub fn enqueue(&self, batch: IrBatch, priority: Priority)
Enqueue an IR batch for processing. Called from JS thread via JSI.
Sourcepub fn is_processing(&self) -> bool
pub fn is_processing(&self) -> bool
Check if the engine is currently processing a frame. JS scheduler uses this for backpressure — if true, coalesce more.
Sourcepub fn drain_frame(&self) -> Vec<IrBatch>
pub fn drain_frame(&self) -> Vec<IrBatch>
Drain pending work items for the current frame. Returns batches to process, coalescing multiple Normal/Low priority batches into a single processing round.
Rules:
- Immediate priority: return immediately (one at a time)
- UserBlocking: return all UserBlocking items in queue
- Normal/Low: coalesce up to MAX_COALESCE_COUNT
- Idle: only return if no other priority is pending
Sourcepub fn record_frame(
&self,
layout_duration: Duration,
mount_duration: Duration,
batches_processed: u32,
)
pub fn record_frame( &self, layout_duration: Duration, mount_duration: Duration, batches_processed: u32, )
Record frame timing (called by Engine after processing).
Sourcepub fn stats(&self) -> FrameStats
pub fn stats(&self) -> FrameStats
Get current frame statistics (for DevTools).
Sourcepub fn has_pending_work(&self) -> bool
pub fn has_pending_work(&self) -> bool
Check if there’s pending work.
Auto Trait Implementations§
impl Freeze for Scheduler
impl RefUnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin for Scheduler
impl UnwindSafe for Scheduler
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