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: u32Implementations§
Source§impl<const MAX_CORES: usize> GenericAffinityMask<MAX_CORES>
impl<const MAX_CORES: usize> GenericAffinityMask<MAX_CORES>
const BITS: usize
const _ASSERT_VALID_MAX_CORES: ()
Sourcepub const fn all() -> Self
pub const fn all() -> Self
Constructs an affinity mask allowing the thread to run on any configured core.
Sourcepub const fn pinned_to_core(core: GenericCoreId<MAX_CORES>) -> Self
pub const fn pinned_to_core(core: GenericCoreId<MAX_CORES>) -> Self
Constructs an affinity mask pinning the thread exclusively to a single core.
Sourcepub const fn from_raw(mask: u32) -> Result<Self>
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).
Sourcepub const fn contains(&self, core: GenericCoreId<MAX_CORES>) -> bool
pub const fn contains(&self, core: GenericCoreId<MAX_CORES>) -> bool
Returns true if the thread is permitted to execute on core.
Sourcepub const fn lowest_core(&self) -> GenericCoreId<MAX_CORES>
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>
impl<const MAX_CORES: usize> Clone for GenericAffinityMask<MAX_CORES>
impl<const MAX_CORES: usize> Copy for GenericAffinityMask<MAX_CORES>
Source§impl<const MAX_CORES: usize> Debug for GenericAffinityMask<MAX_CORES>
impl<const MAX_CORES: usize> Debug for GenericAffinityMask<MAX_CORES>
impl<const MAX_CORES: usize> Eq for GenericAffinityMask<MAX_CORES>
Source§impl<const MAX_CORES: usize> PartialEq for GenericAffinityMask<MAX_CORES>
impl<const MAX_CORES: usize> PartialEq for GenericAffinityMask<MAX_CORES>
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 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)