Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. Priority

Priority

Enum Priority 

Source
#[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

Source

pub const IDLE_PRIORITY: Priority = Priority::Level0

Source

pub const DEFAULT_PRIORITY: Priority = Priority::Level15

Source

pub const NUM_PRIORITIES: usize

The total number of priorities supported.

Trait Implementations§

Source§

impl Clone for Priority

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Priority

Source§

impl Debug for Priority

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Priority

Source§

impl Ord for Priority

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0 (const: unstable)§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable)§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable)§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Priority

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable)§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Priority

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable)§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable)§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable)§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable)§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

fn cast_into(self) -> U

§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.