pub enum Priority {
Low,
Normal,
High,
Custom(u32),
}Expand description
Priority level for tasks
Ordering is based on weight values: Low (10) < Normal (50) < High (100).
Custom(w) is ordered by its weight value relative to the standard priorities.
§Example
use reinhardt_tasks::Priority;
let high = Priority::High;
let normal = Priority::Normal;
let low = Priority::Low;
assert!(high > normal);
assert!(normal > low);
// Custom priority is ordered by weight value
let custom_75 = Priority::Custom(75);
assert!(custom_75 > normal); // 75 > 50
assert!(custom_75 < high); // 75 < 100
let custom_200 = Priority::Custom(200);
assert!(custom_200 > high); // 200 > 100Variants§
Low
Low priority (weight: 10)
Normal
Normal priority (weight: 50)
High
High priority (weight: 100)
Custom(u32)
Custom priority with specified weight
Implementations§
Source§impl Priority
impl Priority
Sourcepub fn default_weight(&self) -> u32
pub fn default_weight(&self) -> u32
Get the default weight for this priority
§Example
use reinhardt_tasks::Priority;
assert_eq!(Priority::High.default_weight(), 100);
assert_eq!(Priority::Normal.default_weight(), 50);
assert_eq!(Priority::Low.default_weight(), 10);
assert_eq!(Priority::Custom(75).default_weight(), 75);Trait Implementations§
Source§impl Ord for Priority
impl Ord for Priority
Source§impl PartialOrd for Priority
impl PartialOrd for Priority
impl Copy for Priority
impl Eq for Priority
Auto Trait Implementations§
impl Freeze for Priority
impl RefUnwindSafe for Priority
impl Send for Priority
impl Sync for Priority
impl Unpin for Priority
impl UnsafeUnpin for Priority
impl UnwindSafe for Priority
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.