Struct bgfx::Memory [] [src]

pub struct Memory<'b> {
    // some fields omitted
}

bgfx-managed buffer of memory.

It can be created by either copying existing data through copy(...), or by referencing existing memory directly through reference(...).

Methods

impl<'b> Memory<'b>

fn copy<'d, T>(_bgfx: &'b Bgfx, data: &'d [T]) -> Memory<'b>

Copies the source data into a new bgfx-managed buffer.

IMPORTANT: If this buffer is never passed into a bgfx call, the memory will never be freed, and will leak.

fn reference<T>(_bgfx: &'b Bgfx, data: &'b [T]) -> Memory<'b>

Creates a reference to the source data for passing into bgfx. When using this constructor over the copy call, no copy will be created. bgfx will read the source memory directly.

Note that this is only valid for memory that will live for longer than the bgfx object, as it's the only way we can guarantee that the memory will still be valid until bgfx has finished using it.