pub struct BufferChunk { /* private fields */ }Expand description
BufferChunk is a lockable pinned byte-slice All modifications to the Chunk goes through the get_slice method
Implementations§
Source§impl BufferChunk
impl BufferChunk
Sourcepub fn new(size: usize) -> BufferChunk
pub fn new(size: usize) -> BufferChunk
Allocate a new Default BufferChunk
Sourcepub fn from_chunk(
raw_chunk: *mut dyn Chunk,
allocator: Arc<dyn ChunkAllocator>,
) -> BufferChunk
pub fn from_chunk( raw_chunk: *mut dyn Chunk, allocator: Arc<dyn ChunkAllocator>, ) -> BufferChunk
Creates a BufferChunk using the given Chunk
pub fn is_empty(&self) -> bool
Sourcepub fn swap_buffer(&mut self, other: &mut BufferChunk)
pub fn swap_buffer(&mut self, other: &mut BufferChunk)
Swaps self with other in-place
Sourcepub fn get_lease(&mut self, from: usize, to: usize) -> ChunkLease
pub fn get_lease(&mut self, from: usize, to: usize) -> ChunkLease
Returns a ChunkLease pointing to the subslice between from and toof the BufferChunk
the returned lease is a consumable Buf.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BufferChunk
impl !RefUnwindSafe for BufferChunk
impl !Sync for BufferChunk
impl Unpin for BufferChunk
impl UnsafeUnpin for BufferChunk
impl !UnwindSafe for BufferChunk
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