Skip to main content

AnyStorage

Trait AnyStorage 

Source
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§

Source

fn get_ptr_on_current(&self, guard: &DisabledLocalIrqGuard) -> *const T

Gets the const pointer for the object on the current CPU.

Source

fn get_ptr_on_target(&self, cpu: CpuId) -> *const T

Gets the const pointer for the object on a target CPU.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§