[][src]Trait gfx_memory::Allocator

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

    const KIND: Kind;

    fn alloc(
        &mut self,
        device: &B::Device,
        size: Size,
        align: Size
    ) -> Result<(Self::Block, Size), AllocationError>;
fn free(&mut self, device: &B::Device, block: Self::Block) -> Size; }

Allocator trait implemented for various allocators.

Associated Types

type Block: Block<B>

Block type returned by allocator.

Loading content...

Associated Constants

const KIND: Kind

Allocator kind.

Loading content...

Required methods

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

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

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

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

Loading content...

Implementors

impl<B: Backend> Allocator<B> for DedicatedAllocator[src]

type Block = DedicatedBlock<B>

impl<B: Backend> Allocator<B> for GeneralAllocator<B>[src]

type Block = GeneralBlock<B>

impl<B: Backend> Allocator<B> for LinearAllocator<B>[src]

type Block = LinearBlock<B>

Loading content...