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

Associated Constants

const KIND: Kind[]

Allocator kind.

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.

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>