pub struct SplittableBuffer { /* private fields */ }Expand description
A wrapper around OwnedBuffer that allows carving out independent child OwnedBuffers
and recovering the original OwnedBuffer via a SplittableBufferHandle once all child
buffers have been dropped.
Implementations§
Source§impl SplittableBuffer
impl SplittableBuffer
Sourcepub fn new(buffer: OwnedBuffer) -> (Self, SplittableBufferHandle)
pub fn new(buffer: OwnedBuffer) -> (Self, SplittableBufferHandle)
Creates a new SplittableBuffer along with a clonable SplittableBufferHandle that can be
used to recover the merged buffer once all child OwnedBuffers and other handles drop.
Sourcepub fn remaining_range(&self) -> Range<usize>
pub fn remaining_range(&self) -> Range<usize>
Returns the remaining unallocated range available for splitting.
Sourcepub fn take_prefix(&mut self, len: usize) -> OwnedBuffer
pub fn take_prefix(&mut self, len: usize) -> OwnedBuffer
Carves out the first len bytes of the remaining unsplit buffer as a new OwnedBuffer.
§Panics
Panics if len exceeds remaining_range.len().
Trait Implementations§
Source§impl Debug for SplittableBuffer
impl Debug for SplittableBuffer
impl Send for SplittableBuffer
impl Sync for SplittableBuffer
Auto Trait Implementations§
impl !RefUnwindSafe for SplittableBuffer
impl !UnwindSafe for SplittableBuffer
impl Freeze for SplittableBuffer
impl Unpin for SplittableBuffer
impl UnsafeUnpin for SplittableBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more