pub struct ChunkedBuffer { /* private fields */ }Expand description
A buffer that manages chunked data.
Implementations§
Source§impl ChunkedBuffer
impl ChunkedBuffer
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a new chunked buffer with default settings.
Sourcepub fn calculate_chunks(&self, total_size: u64) -> usize
pub fn calculate_chunks(&self, total_size: u64) -> usize
Calculate the number of chunks needed for a given size.
Sourcepub fn descriptor_for_index(
&self,
index: usize,
total_size: u64,
) -> ChunkDescriptor
pub fn descriptor_for_index( &self, index: usize, total_size: u64, ) -> ChunkDescriptor
Get a chunk descriptor for a given index.
Sourcepub async fn push(&self, descriptor: ChunkDescriptor, data: Bytes) -> Result<()>
pub async fn push(&self, descriptor: ChunkDescriptor, data: Bytes) -> Result<()>
Push a chunk into the buffer.
Sourcepub async fn pop(&self) -> Result<Option<(ChunkDescriptor, Bytes)>>
pub async fn pop(&self) -> Result<Option<(ChunkDescriptor, Bytes)>>
Pop a chunk from the buffer.
Sourcepub async fn peek(&self) -> Result<Option<ChunkDescriptor>>
pub async fn peek(&self) -> Result<Option<ChunkDescriptor>>
Peek at the next chunk without removing it.
Sourcepub async fn size_bytes(&self) -> usize
pub async fn size_bytes(&self) -> usize
Get the current buffer size in bytes.
Sourcepub async fn is_complete(&self) -> bool
pub async fn is_complete(&self) -> bool
Check if writing is complete.
Sourcepub async fn stats(&self) -> BufferStats
pub async fn stats(&self) -> BufferStats
Get buffer statistics.
Auto Trait Implementations§
impl !RefUnwindSafe for ChunkedBuffer
impl !UnwindSafe for ChunkedBuffer
impl Freeze for ChunkedBuffer
impl Send for ChunkedBuffer
impl Sync for ChunkedBuffer
impl Unpin for ChunkedBuffer
impl UnsafeUnpin for ChunkedBuffer
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