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§

source

fn capacity(&self) -> usize

Returns how many bytes of accessible memory occupies.

source

fn offset(&self) -> usize

Returns the accessible offset to the pointer of the allocator.

source

fn memory_capacity(&self) -> usize

Returns how many bytes of the whole memory occupies.

source

fn memory_offset(&self) -> usize

Returns the offset to the pointer of the allocator.

source

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.
source

fn flush(&self) -> Result<()>

Available on crate feature memmap and non-target_family="wasm" only.

Flush the buffer to the disk.

source

fn flush_async(&self) -> Result<()>

Available on crate feature memmap and non-target_family="wasm" only.

Asynchronously flush the buffer to the disk.

Implementors§

source§

impl<'a, A: Allocator> Memory for BytesRefMut<'a, A>

source§

impl<'a, T, A: Allocator> Memory for RefMut<'a, T, A>

source§

impl<A: Allocator> Memory for BytesMut<A>

source§

impl<T, A: Allocator> Memory for Owned<T, A>