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;
fn get_mut_ptr_on_target(&mut self, cpu: CpuId) -> *mut 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.
Sourcefn get_mut_ptr_on_target(&mut self, cpu: CpuId) -> *mut T
fn get_mut_ptr_on_target(&mut self, cpu: CpuId) -> *mut T
Gets the mut
pointer for the object on a target CPU.
This method is intended for use when initializing or dropping the storage.