pub struct ReadExact { /* private fields */ }
Expand description
I/O-free coroutine for reading bytes into a buffer until it reaches a given amount of bytes.
Implementations§
Source§impl ReadExact
impl ReadExact
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>)
Adds the given bytes the to inner buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReadExact
impl RefUnwindSafe for ReadExact
impl Send for ReadExact
impl Sync for ReadExact
impl Unpin for ReadExact
impl UnwindSafe for ReadExact
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