pub struct ReadChunkSource<R, B> { /* private fields */ }
Expand description
A ChunkSource
that reads from any std::io::Read
type.
This struct manages an internal buffer, which is filled with data on each read operation. You can configure the buffer size to balance memory usage and I/O performance.
Implementations§
Source§impl<R, B> ReadChunkSource<R, B>
impl<R, B> ReadChunkSource<R, B>
Sourcepub fn new(reader: R, buffer: B) -> Self
pub fn new(reader: R, buffer: B) -> Self
Creates a new ReadChunkSource
with the given reader and a pre-allocated buffer.
The size of the chunks read will be determined by the buffer’s capacity.
Sourcepub fn with_capacity(reader: R, capacity: usize) -> ReadChunkSource<R, Vec<u8>>
pub fn with_capacity(reader: R, capacity: usize) -> ReadChunkSource<R, Vec<u8>>
Creates a new ReadChunkSource
with the specified buffer capacity.
This is a convenience method that creates a new Vec<u8>
with the given
capacity to use as the internal buffer.
Trait Implementations§
Source§impl<R, B> ChunkSource for ReadChunkSource<R, B>
impl<R, B> ChunkSource for ReadChunkSource<R, B>
Auto Trait Implementations§
impl<R, B> Freeze for ReadChunkSource<R, B>
impl<R, B> RefUnwindSafe for ReadChunkSource<R, B>where
R: RefUnwindSafe,
B: RefUnwindSafe,
impl<R, B> Send for ReadChunkSource<R, B>
impl<R, B> Sync for ReadChunkSource<R, B>
impl<R, B> Unpin for ReadChunkSource<R, B>
impl<R, B> UnwindSafe for ReadChunkSource<R, B>where
R: UnwindSafe,
B: UnwindSafe,
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