pub unsafe trait AnyStorage<T> {
// Required methods
fn get_ptr_on_current(&self, guard: &DisabledLocalIrqGuard) -> *const T;
fn get_ptr_on_target(&self, cpu: CpuId) -> *const T;
}Expand description
A trait to abstract any type that can be used as a slot for a CPU-local
variable of type T.
Each slot provides the memory space for storing num_cpus instances
of type T.
§Safety
The implementor must ensure that the returned pointer refers to the variable on the correct CPU.
Required Methods§
Sourcefn get_ptr_on_current(&self, guard: &DisabledLocalIrqGuard) -> *const T
fn get_ptr_on_current(&self, guard: &DisabledLocalIrqGuard) -> *const T
Gets the const pointer for the object on the current CPU.
Sourcefn get_ptr_on_target(&self, cpu: CpuId) -> *const T
fn get_ptr_on_target(&self, cpu: CpuId) -> *const T
Gets the const pointer for the object on a target CPU.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".