Enum dioxus_core::EventPriority
source · [−]pub enum EventPriority {
Immediate,
High,
Medium,
Low,
}Expand description
Priority of Event Triggers.
Internally, Dioxus will abort work that’s taking too long if new, more important work arrives. Unlike React, Dioxus won’t be afraid to pause work or flush changes to the RealDOM. This is called “cooperative scheduling”. Some Renderers implement this form of scheduling internally, however Dioxus will perform its own scheduling as well.
The ultimate goal of the scheduler is to manage latency of changes, prioritizing “flashier” changes over “subtler” changes.
React has a 5-tier priority system. However, they break things into “Continuous” and “Discrete” priority. For now, we keep it simple, and just use a 3-tier priority system.
- NoPriority = 0
- LowPriority = 1
- NormalPriority = 2
- UserBlocking = 3
- HighPriority = 4
- ImmediatePriority = 5
We still have a concept of discrete vs continuous though - discrete events won’t be batched, but continuous events will. This means that multiple “scroll” events will be processed in a single frame, but multiple “click” events will be flushed before proceeding. Multiple discrete events is highly unlikely, though.
Variants
Immediate
Work that must be completed during the EventHandler phase.
Currently this is reserved for controlled inputs.
High
“High Priority” work will not interrupt other high priority work, but will interrupt medium and low priority work.
This is typically reserved for things like user interaction.
React calls these “discrete” events, but with an extra category of “user-blocking” (Immediate).
Medium
“Medium priority” work is generated by page events not triggered by the user. These types of events are less important than “High Priority” events and will take precedence over low priority events.
This is typically reserved for VirtualEvents that are not related to keyboard or mouse input.
React calls these “continuous” events (e.g. mouse move, mouse wheel, touch move, etc).
Low
“Low Priority” work will always be preempted unless the work is significantly delayed, in which case it will be advanced to the front of the work queue until completed.
The primary user of Low Priority work is the asynchronous work system (Suspense).
This is considered “idle” work or “background” work.
Trait Implementations
sourceimpl Clone for EventPriority
impl Clone for EventPriority
sourcefn clone(&self) -> EventPriority
fn clone(&self) -> EventPriority
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for EventPriority
impl Debug for EventPriority
sourceimpl Hash for EventPriority
impl Hash for EventPriority
sourceimpl Ord for EventPriority
impl Ord for EventPriority
sourceimpl PartialEq<EventPriority> for EventPriority
impl PartialEq<EventPriority> for EventPriority
sourceimpl PartialOrd<EventPriority> for EventPriority
impl PartialOrd<EventPriority> for EventPriority
sourcefn partial_cmp(&self, other: &EventPriority) -> Option<Ordering>
fn partial_cmp(&self, other: &EventPriority) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Copy for EventPriority
impl Eq for EventPriority
impl StructuralEq for EventPriority
impl StructuralPartialEq for EventPriority
Auto Trait Implementations
impl RefUnwindSafe for EventPriority
impl Send for EventPriority
impl Sync for EventPriority
impl Unpin for EventPriority
impl UnwindSafe for EventPriority
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more