rarena_allocator

Trait Buffer

source
pub trait Buffer {
    // Required methods
    fn capacity(&self) -> usize;
    fn offset(&self) -> usize;
    fn buffer_capacity(&self) -> usize;
    fn buffer_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 buffer occupies.

source

fn offset(&self) -> usize

Returns the accessible offset to the pointer of the allocator.

source

fn buffer_capacity(&self) -> usize

Returns how many bytes of the whole buffer occupies.

source

fn buffer_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 buffer 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: Allocator> Buffer for BytesMut<A>

source§

impl<A: Allocator> Buffer for BytesRefMut<'_, A>

source§

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

source§

impl<T, A: Allocator> Buffer for RefMut<'_, T, A>