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. PriorityBitmask

PriorityBitmask

Struct PriorityBitmask 

Source
pub struct PriorityBitmask {
    bitmasks: [usize; 1],
}
Expand description

Provides bitmask utility sufficient for tracking the status of all priorities. All operations are restricted to the valid range of priorities.

Fields§

§bitmasks: [usize; 1]

Invariant: The bits set within bitmasks always correspond to valid Priority enum values. This is enforced by the set_priority and clear_priority methods, which only accept Priority enum values.

Implementations§

Source§

impl PriorityBitmask

Source

const BITS_PER_CHUNK: usize

Source

const CHUNKS: usize

Source

pub const fn new() -> Self

Source

pub fn set_priority(&mut self, priority: Priority)

Marks a priority as active.

Source

pub fn clear_priority(&mut self, priority: Priority)

Marks a priority as inactive.

Source

pub fn get_highest_priority(&self) -> Option<Priority>

Retrieves the highest priority that is active. If no priorities are active, None is returned.

Trait Implementations§

Source§

impl Default for PriorityBitmask

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for PriorityBitmask

§

impl Freeze for PriorityBitmask

§

impl Move for PriorityBitmask

§

impl RefUnwindSafe for PriorityBitmask

§

impl Send for PriorityBitmask

§

impl Sync for PriorityBitmask

§

impl Unpin for PriorityBitmask

§

impl UnsafeUnpin for PriorityBitmask

§

impl UnwindSafe for PriorityBitmask

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> 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.