Trait rarena_allocator::Memory
source · pub trait Memory {
// Required methods
fn capacity(&self) -> usize;
fn offset(&self) -> usize;
fn memory_capacity(&self) -> usize;
fn memory_offset(&self) -> usize;
unsafe fn detach(&mut self);
fn flush(&self) -> Result<()>;
fn flush_async(&self) -> Result<()>;
}Expand description
The memory chunk allocated from the allocator.
Required Methods§
sourcefn memory_capacity(&self) -> usize
fn memory_capacity(&self) -> usize
Returns how many bytes of the whole memory occupies.
sourcefn memory_offset(&self) -> usize
fn memory_offset(&self) -> usize
Returns the offset to the pointer of the allocator.
sourceunsafe fn detach(&mut self)
unsafe fn detach(&mut self)
Detach the value from the ARENA, which means when the value is dropped, the underlying memory will not be collected for futhur allocation.
§Safety
- The caller must ensure the value is dropped before the ARENA is dropped.
sourcefn flush(&self) -> Result<()>
Available on crate feature memmap and non-target_family="wasm" only.
fn flush(&self) -> Result<()>
memmap and non-target_family="wasm" only.Flush the buffer to the disk.
sourcefn flush_async(&self) -> Result<()>
Available on crate feature memmap and non-target_family="wasm" only.
fn flush_async(&self) -> Result<()>
memmap and non-target_family="wasm" only.Asynchronously flush the buffer to the disk.