pub struct ReadChunkSource<R, B = Vec<u8>> { /* private fields */ }👎Deprecated since 0.3.1: This sync-only struct is superseded by the runtime-agnostic
unescape_stream_into! macro.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_buffer_size(reader: R, size: usize) -> ReadChunkSource<R, Vec<u8>>
pub fn with_buffer_size(reader: R, size: usize) -> ReadChunkSource<R, Vec<u8>>
Creates a new ReadChunkSource with the specified buffer size.
This is a convenience method that creates a new Vec<u8> with the given
length (not just 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>
Source§type Error = Error
type Error = Error
👎Deprecated since 0.3.1: This sync-only trait is superseded by the runtime-agnostic
unescape_stream_into! macro.The type of error that can occur when reading a chunk.
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