pub struct DataPerNUMANodeManager<T>(/* private fields */);Expand description
Manages data per NUMA node. It allows storing data for each NUMA node and accessing it by the NUMA node ID.
§Example
use orengine_utils::numa::{DataPerNUMANodeManager, get_current_thread_numa_node};
// Create a manager with data for each NUMA node
static MANAGER: DataPerNUMANodeManager<usize> = DataPerNUMANodeManager::from_arr([0; 64]);
let numa_node = get_current_thread_numa_node();
println!("Memory by {numa_node} NUMA node contains {}", MANAGER.get_ref_by_node(numa_node));Implementations§
Source§impl<T> DataPerNUMANodeManager<T>
impl<T> DataPerNUMANodeManager<T>
Sourcepub const fn from_arr(inner: [T; 64]) -> Self
pub const fn from_arr(inner: [T; 64]) -> Self
Creates a new manager from an array of data for each NUMA node.
Sourcepub fn get_ref_by_node(&self, numa_node: usize) -> &T
pub fn get_ref_by_node(&self, numa_node: usize) -> &T
Gets a reference to the data for the specified NUMA node.
§Panics
Panics if the NUMA node ID is out of bounds.
Sourcepub fn get_mut_by_node(&mut self, numa_node: usize) -> &mut T
pub fn get_mut_by_node(&mut self, numa_node: usize) -> &mut T
Gets a mutable reference to the data for the specified NUMA node.
§Panics
Panics if the NUMA node ID is out of bounds.
Sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over references to the data for all NUMA nodes.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for DataPerNUMANodeManager<T>where
T: Freeze,
impl<T> RefUnwindSafe for DataPerNUMANodeManager<T>where
T: RefUnwindSafe,
impl<T> Send for DataPerNUMANodeManager<T>where
T: Send,
impl<T> Sync for DataPerNUMANodeManager<T>where
T: Sync,
impl<T> Unpin for DataPerNUMANodeManager<T>where
T: Unpin,
impl<T> UnsafeUnpin for DataPerNUMANodeManager<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for DataPerNUMANodeManager<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more