Trait ComputeStorage

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

    // Required methods
    fn alignment(&self) -> usize;
    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 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 alignment(&self) -> usize

The alignment memory is allocated with in this storage.

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].

Implementors§