Skip to main content

WorkClass

Trait WorkClass 

Source
pub trait WorkClass:
    Sealed
    + Send
    + Sync
    + 'static {
    const AFFINITY_OFFSET: usize;
    const SERIAL_AFFINITY_OFFSET: usize;
    const NAME: &'static str;
    const USES_ASYNC_LANE: bool;
    const USES_BLOCKING_LANE: bool;
}
Expand description

Compile-time routing contract for a scheduler work class.

Implementors are zero-sized marker types. The scheduler monomorphizes dispatch per marker and uses the associated constants for deterministic worker selection without storing a runtime policy object.

Required Associated Constants§

Source

const AFFINITY_OFFSET: usize

Offset mixed into round-robin worker selection for this work class.

Source

const SERIAL_AFFINITY_OFFSET: usize

Worker offset used for serial handoff when no queued backlog exists.

Serial result-bearing submit/join loops benefit from a single stable worker cache footprint. The value is an associated constant so the scheduler monomorphizes the routing decision per work class.

Source

const NAME: &'static str

Stable diagnostic name for this work class.

Source

const USES_ASYNC_LANE: bool

Whether this work class is eligible for asynchronous lane routing.

Source

const USES_BLOCKING_LANE: bool

Whether this work class uses the dedicated bounded blocking lane.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§