hal_core

Trait CoreLocal

Source
pub trait CoreLocal<T: 'static> {
    // Required methods
    fn new(init: fn() -> T) -> Self;
    fn with<F, U>(&self, f: F) -> U
       where F: FnOnce(&T) -> U;
}
Expand description

A core-local storage cell.

This trait represents an architecture-specific mechanism for storing local data for each CPU core.

Required Methods§

Source

fn new(init: fn() -> T) -> Self

Returns a new instance of Self, using the provided init function to generate the initial value for each CPU core.

Source

fn with<F, U>(&self, f: F) -> U
where F: FnOnce(&T) -> U,

Accesses the value for the current CPU core.

This method invokes the provided closure f with a reference to the T-typed local data for the current CPU core.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§