#[repr(u8)]pub enum Priority {
Show 32 variants
Level0 = 0,
Level1 = 1,
Level2 = 2,
Level3 = 3,
Level4 = 4,
Level5 = 5,
Level6 = 6,
Level7 = 7,
Level8 = 8,
Level9 = 9,
Level10 = 10,
Level11 = 11,
Level12 = 12,
Level13 = 13,
Level14 = 14,
Level15 = 15,
Level16 = 16,
Level17 = 17,
Level18 = 18,
Level19 = 19,
Level20 = 20,
Level21 = 21,
Level22 = 22,
Level23 = 23,
Level24 = 24,
Level25 = 25,
Level26 = 26,
Level27 = 27,
Level28 = 28,
Level29 = 29,
Level30 = 30,
Level31 = 31,
}Expand description
Represents the priority of a thread.
Note: An enum is used to provide guarantees to the compiler about the range of values that can be used. An example of where this is useful is that it can allow the compiler to elide bounds checks for an array indexed by Priority. Another example is that it allows for eliding valid range checks in bitmask operations. Downsides include that the Priority declaration is quite verbose and normal integer operations are not straightforward.
This is designed such that:
- The priority can be used as an index in an array.
- An array indexed by all priorities will be compact with no gaps.
A choice was made to explicitly support 32 priorities initially with the possibility of customizing the Priority type being supported in the future.
Variants§
Level0 = 0
Level1 = 1
Level2 = 2
Level3 = 3
Level4 = 4
Level5 = 5
Level6 = 6
Level7 = 7
Level8 = 8
Level9 = 9
Level10 = 10
Level11 = 11
Level12 = 12
Level13 = 13
Level14 = 14
Level15 = 15
Level16 = 16
Level17 = 17
Level18 = 18
Level19 = 19
Level20 = 20
Level21 = 21
Level22 = 22
Level23 = 23
Level24 = 24
Level25 = 25
Level26 = 26
Level27 = 27
Level28 = 28
Level29 = 29
Level30 = 30
Level31 = 31
Implementations§
Source§impl Priority
impl Priority
pub const IDLE_PRIORITY: Priority = Priority::Level0
pub const DEFAULT_PRIORITY: Priority = Priority::Level15
Sourcepub const NUM_PRIORITIES: usize
pub const NUM_PRIORITIES: usize
The total number of priorities supported.
Trait Implementations§
impl Copy for Priority
impl Eq for Priority
Source§impl Ord for Priority
impl Ord for Priority
1.21.0 (const: unstable)§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable)§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Priority
impl PartialOrd for Priority
impl StructuralPartialEq for Priority
Auto Trait Implementations§
impl Forget for Priority
impl Freeze for Priority
impl Move 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§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)