Trait ComputeStorage

Source
pub trait ComputeStorage: Send {
    type Resource: Send;

    const ALIGNMENT: u64;

    // Required methods
    fn get(&mut self, handle: &StorageHandle) -> Self::Resource;
    fn alloc(&mut self, size: u64) -> StorageHandle;
    fn dealloc(&mut self, id: StorageId);
}
Expand description

Storage types are responsible for allocating and deallocating memory.

Required Associated Constants§

Source

const ALIGNMENT: u64

The alignment memory is allocated with in this storage.

Required Associated Types§

Source

type Resource: Send

The resource associated type determines the way data is implemented and how it can be accessed by kernels.

Required Methods§

Source

fn get(&mut self, handle: &StorageHandle) -> Self::Resource

Returns the underlying resource for a specified storage handle

Source

fn alloc(&mut self, size: u64) -> StorageHandle

Allocates size units of memory and returns a handle to it

Source

fn dealloc(&mut self, id: StorageId)

Deallocates the memory pointed by the given storage id.

These deallocations might need to be flushed with [Self::perform_deallocations].

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§