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: BufferImpl<'static, Arc<dyn BufferAllocator>, dyn BufferAllocator>,
) -> (SplittableBuffer, SplittableBufferHandle)
pub fn new( buffer: BufferImpl<'static, Arc<dyn BufferAllocator>, dyn BufferAllocator>, ) -> (SplittableBuffer, 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,
) -> BufferImpl<'static, Arc<dyn BufferAllocator>, dyn BufferAllocator>
pub fn take_prefix( &mut self, len: usize, ) -> BufferImpl<'static, Arc<dyn BufferAllocator>, dyn BufferAllocator>
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more