Skip to main content

euv_core/runtime/dispatcher/
enum.rs

1/// Scheduling priority lane for cross-thread mutations posted to `UiDispatcher`.
2#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub enum DispatchPriority {
4    /// Frame-critical input, lifecycle, or high-priority UI state update drained first.
5    Critical,
6    /// Standard application or network callback UI update.
7    #[default]
8    Normal,
9    /// Low-priority background telemetry, prefetch, or deferred update drained last.
10    Background,
11}
12
13/// Overflow handling strategy applied when `UiDispatcher` reaches its configured capacity.
14#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub enum DispatchBackpressurePolicy {
16    /// Reject incoming submissions with `DispatchError::QueueFull` once capacity is reached.
17    #[default]
18    RejectNew,
19    /// Evict the oldest lowest-priority queued task to admit the incoming submission.
20    DropOldest,
21}
22
23/// Error returned when a cross-thread task cannot be accepted by `UiDispatcher`.
24#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
25pub enum DispatchError {
26    /// Bounded queue reached capacity under `DispatchBackpressurePolicy::RejectNew`.
27    QueueFull,
28    /// Dispatcher has been closed and no longer accepts new tasks.
29    Closed,
30    /// Underlying queue synchronization primitive was poisoned by an external panic.
31    LockPoisoned,
32}