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

GenericAffinityMask

Struct GenericAffinityMask 

Source
pub struct GenericAffinityMask<const MAX_CORES: usize>(u32);
Expand description

Thread CPU affinity mask for a system with up to MAX_CORES cores.

Represents the set of CPU cores on which a thread is permitted to execute.

Tuple Fields§

§0: u32

Implementations§

Source§

impl<const MAX_CORES: usize> GenericAffinityMask<MAX_CORES>

Source

const BITS: usize

Source

const _ASSERT_VALID_MAX_CORES: ()

Source

pub const fn all() -> Self

Constructs an affinity mask allowing the thread to run on any configured core.

Source

pub const fn pinned_to_core(core: GenericCoreId<MAX_CORES>) -> Self

Constructs an affinity mask pinning the thread exclusively to a single core.

Source

pub const fn from_raw(mask: u32) -> Result<Self>

Constructs an affinity mask from a raw bitmask.

Returns Err(Error::InvalidArgument) if mask is zero or sets any bits outside the configured cores (>= 1 << MAX_CORES).

Source

pub const fn contains(&self, core: GenericCoreId<MAX_CORES>) -> bool

Returns true if the thread is permitted to execute on core.

Source

pub const fn lowest_core(&self) -> GenericCoreId<MAX_CORES>

Returns the lowest-numbered core permitted by this affinity mask.

Trait Implementations§

Source§

impl<const MAX_CORES: usize> Clone for GenericAffinityMask<MAX_CORES>

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<const MAX_CORES: usize> Copy for GenericAffinityMask<MAX_CORES>

Source§

impl<const MAX_CORES: usize> Debug for GenericAffinityMask<MAX_CORES>

Source§

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

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

impl<const MAX_CORES: usize> Eq for GenericAffinityMask<MAX_CORES>

Source§

impl<const MAX_CORES: usize> PartialEq for GenericAffinityMask<MAX_CORES>

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<const MAX_CORES: usize> StructuralPartialEq for GenericAffinityMask<MAX_CORES>

Auto Trait Implementations§

§

impl<const MAX_CORES: usize> Forget for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> Freeze for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> Move for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> RefUnwindSafe for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> Send for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> Sync for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> Unpin for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> UnsafeUnpin for GenericAffinityMask<MAX_CORES>

§

impl<const MAX_CORES: usize> UnwindSafe for GenericAffinityMask<MAX_CORES>

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.