[][src]Struct cpu_affinity::PerLogicalCoreData

pub struct PerLogicalCoreData<T> { /* fields omitted */ }

Data with an item per logical core in use by the process.

Methods

impl<T> PerLogicalCoreData<T>
[src]

pub fn empty(logical_cores: &LogicalCores) -> Self
[src]

Creates an empty set of logical core data.

pub fn new(
    logical_cores: &LogicalCores,
    constructor: impl FnMut(u16) -> T
) -> Self
[src]

constructor is called for each defined logical core in logical_cores; it is passed the logical core's identifier.

pub fn get(&self, logical_core_identifier: u16) -> Option<&T>
[src]

Gets the data for a particular logical core.

If the logical core does not exist (or does not have assigned data), returns None; this can happen on Linux if using the SO_INCOMING_CPU socket option, which can map to a CPU not assigned to the process.

pub fn get_mut(&mut self, logical_core_identifier: u16) -> Option<&mut T>
[src]

Gets the mutable data for a particular logical core.

If the logical core does not exist (or does not have assigned data), returns None; this can happen on Linux if using theSO_INCOMING_CPU socket option, which can return an index for a CPU not assigned to the process.

pub fn get_mut_or(
    &mut self,
    logical_core_identifier: u16,
    default_logical_core_identifier: impl FnOnce() -> u16
) -> &mut T
[src]

Gets the mutable data for a particular logical core; if no data for that core, gets it for the default_logical_core_identifier.

If the logical core does not exist (or does not have assigned data), returns None; this can happen on Linux if using theSO_INCOMING_CPU socket option, which can return an index for a CPU not assigned to the process.

pub fn set(&mut self, logical_core_identifier: u16, value: T)
[src]

Sets the current value, discarding the old one.

pub fn take(&mut self, logical_core_identifier: u16) -> Option<T>
[src]

Takes the data for a particular logical core.

If the logical core does not exist (or does not have assigned data), returns None; this can happen on Linux if using the SO_INCOMING_CPU socket option, which can map to a CPU not assigned to the process.

pub fn replace(&mut self, logical_core_identifier: u16, value: T) -> Option<T>
[src]

Replaces the current value, returning the old one.

pub fn logical_core_indices<'a>(
    &'a self
) -> impl Iterator<Item = u16> + 'a
[src]

Iterates over all entries that are not None.

pub fn map<V>(
    self,
    mapper: impl FnMut(u16, T) -> V
) -> PerLogicalCoreData<V>
[src]

Maps from T to V assuming that entries with Some() in them are mappable.

mapper is called for each defined (ie is Some(T)) logical core in logical_cores; it is passed the logical core's identifier and the old value.

Trait Implementations

impl<T: Eq> Eq for PerLogicalCoreData<T>
[src]

impl<T: PartialOrd> PartialOrd<PerLogicalCoreData<T>> for PerLogicalCoreData<T>
[src]

impl<T: PartialEq> PartialEq<PerLogicalCoreData<T>> for PerLogicalCoreData<T>
[src]

impl<T: Clone> Clone for PerLogicalCoreData<T>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Ord> Ord for PerLogicalCoreData<T>
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<T: Debug> Debug for PerLogicalCoreData<T>
[src]

impl<T> DerefMut for PerLogicalCoreData<T>
[src]

impl<T> Deref for PerLogicalCoreData<T>
[src]

type Target = [Option<T>]

The resulting type after dereferencing.

impl<T: Hash> Hash for PerLogicalCoreData<T>
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> Index<u16> for PerLogicalCoreData<T>
[src]

type Output = Option<T>

The returned type after indexing.

impl<T> IndexMut<u16> for PerLogicalCoreData<T>
[src]

Auto Trait Implementations

impl<T> Send for PerLogicalCoreData<T> where
    T: Send

impl<T> Sync for PerLogicalCoreData<T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]