Skip to main content

Scheduler

Struct Scheduler 

Source
pub struct Scheduler<P> { /* private fields */ }
Expand description

Pipeline scheduler that manages batch submission and interleaving.

The scheduler doesn’t own backends directly — instead, callers use Scheduler::next_batch to get the next group of items to submit, then handle submission/polling themselves. This keeps the scheduler backend-agnostic and testable.

Implementations§

Source§

impl<P> Scheduler<P>

Source

pub fn new(config: SchedulerConfig) -> Self

Create a new scheduler with the given configuration.

Source

pub fn enqueue(&mut self, items: impl IntoIterator<Item = WorkItem<P>>)

Add work items to the scheduler’s queue.

Source

pub fn pending_count(&self) -> usize

Number of items currently in the queue.

Source

pub fn is_empty(&self) -> bool

Returns true if the queue is empty.

Source

pub fn next_batch(&mut self) -> Option<Vec<BatchGroup<P>>>

Take the next batch of work items from the queue, grouped optimally.

Returns None if the queue is empty. Otherwise returns a vec of BatchGroups, each containing items that should be submitted together for optimal cache utilization.

Items past max_wait are promoted into this batch regardless of grouping optimality.

Auto Trait Implementations§

§

impl<P> Freeze for Scheduler<P>

§

impl<P> RefUnwindSafe for Scheduler<P>
where P: RefUnwindSafe,

§

impl<P> Send for Scheduler<P>
where P: Send,

§

impl<P> Sync for Scheduler<P>
where P: Sync,

§

impl<P> Unpin for Scheduler<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for Scheduler<P>

§

impl<P> UnwindSafe for Scheduler<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PendingHandle for T
where T: Send + 'static,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V