rendy_memory

Trait Allocator

Source
pub trait Allocator<B: Backend> {
    type Block: Block<B>;

    // Required methods
    fn kind() -> Kind;
    fn alloc(
        &mut self,
        device: &B::Device,
        size: u64,
        align: u64,
    ) -> Result<(Self::Block, u64), AllocationError>;
    fn free(&mut self, device: &B::Device, block: Self::Block) -> u64;
}
Expand description

Allocator trait implemented for various allocators.

Required Associated Types§

Source

type Block: Block<B>

Block type returned by allocator.

Required Methods§

Source

fn kind() -> Kind

Get allocator kind.

Source

fn alloc( &mut self, device: &B::Device, size: u64, align: u64, ) -> Result<(Self::Block, u64), AllocationError>

Allocate block of memory. On success returns allocated block and amount of memory consumed from device.

Source

fn free(&mut self, device: &B::Device, block: Self::Block) -> u64

Free block of memory. Returns amount of memory returned to the device.

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§