pub struct ReadStreamExact { /* private fields */ }
Expand description
I/O-free coroutine to read bytes into a buffer until it reaches a given amount of bytes.
Implementations§
Source§impl ReadStreamExact
impl ReadStreamExact
Sourcepub fn new(max: usize) -> Self
pub fn new(max: usize) -> Self
Creates a new coroutine to read bytes using a buffer with
[Read::DEFAULT_CAPACITY
] capacity.
See Self::with_capacity
for a custom buffer capacity.
Sourcepub fn with_capacity(capacity: usize, max: usize) -> Self
pub fn with_capacity(capacity: usize, max: usize) -> Self
Creates a new coroutine to read bytes using a buffer with the given capacity.
Sourcepub fn extend(&mut self, bytes: impl IntoIterator<Item = u8>)
pub fn extend(&mut self, bytes: impl IntoIterator<Item = u8>)
Extends the inner buffer with the given bytes slice.
Sourcepub fn resume(&mut self, arg: Option<StreamIo>) -> ReadStreamExactResult
pub fn resume(&mut self, arg: Option<StreamIo>) -> ReadStreamExactResult
Makes the coroutine progress.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReadStreamExact
impl RefUnwindSafe for ReadStreamExact
impl Send for ReadStreamExact
impl Sync for ReadStreamExact
impl Unpin for ReadStreamExact
impl UnwindSafe for ReadStreamExact
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