pub struct Reader<'a, Input: Read> { /* private fields */ }Expand description
Reader implements buffering for an std::io::Read object.
Consider using native Rust std::io::BufReader.
Implementations§
Source§impl<'a, Input: Read> Reader<'a, Input>
impl<'a, Input: Read> Reader<'a, Input>
Sourcepub fn new(r: &'a mut Input) -> Self
pub fn new(r: &'a mut Input) -> Self
new creates a reader with the default size buffer
Sourcepub fn new_size(r: &'a mut Input, size: usize) -> Self
pub fn new_size(r: &'a mut Input, size: usize) -> Self
new_size returns a new Reader whose buffer has at least the specified size.
Sourcepub fn reset(&mut self, r: &'a mut Input)
pub fn reset(&mut self, r: &'a mut Input)
reset discards any buffered data, resets all state, and switches the buffered reader to read from r.
Sourcepub fn peek(&mut self, n: usize) -> (&[u8], Option<Box<dyn Error>>)
pub fn peek(&mut self, n: usize) -> (&[u8], Option<Box<dyn Error>>)
peek returns the next n bytes without advancing the reader. The bytes stop being valid at the next read call. If peek returns fewer than n bytes, it also returns an error explaining why the read is short. The error is ERR_BUFFER_FULL if n is larger than b’s buffer size.
Calling peek prevents a UnreadByte or UnreadRune call from succeeding until the next read operation.
Auto Trait Implementations§
impl<'a, Input> Freeze for Reader<'a, Input>
impl<'a, Input> !RefUnwindSafe for Reader<'a, Input>
impl<'a, Input> !Send for Reader<'a, Input>
impl<'a, Input> !Sync for Reader<'a, Input>
impl<'a, Input> Unpin for Reader<'a, Input>
impl<'a, Input> !UnwindSafe for Reader<'a, Input>
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