Struct bgfx_rs::static_lib::Memory
source · pub struct Memory { /* private fields */ }
Expand description
bgfx-managed buffer of memory.
It can be created by either copying existing data through copy(...)
, or by referencing
existing memory directly through reference(...)
.
Implementations§
source§impl Memory
impl Memory
sourcepub fn copy<T>(data: &[T]) -> Memory
pub fn copy<T>(data: &[T]) -> Memory
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.
sourcepub unsafe fn reference<T>(data: &[T]) -> Memory
pub unsafe fn reference<T>(data: &[T]) -> Memory
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 the data passed to this function must be keep alive during the whole duration of the program and is only really recommended for static data unless you know you know what you are doing. Thus this function is marked as unsafe because of this reason.