Buffer

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>