pub struct Peeker<R> { /* private fields */ }Expand description
A Read stream peeker that can be used to check a CSV file’s header.
Implementations§
Source§impl<R: Read> Peeker<R>
impl<R: Read> Peeker<R>
Sourcepub fn from_reader(reader: R) -> Self
pub fn from_reader(reader: R) -> Self
Create a new peeker with default configuration using the provided reader
implementing std::io::Read.
Sourcepub fn has_headers(&self) -> bool
pub fn has_headers(&self) -> bool
Returns whether this peeker has been configured to interpret the first record as a header.
Sourcepub fn has_crlf_newlines(&mut self) -> Result<bool>
pub fn has_crlf_newlines(&mut self) -> Result<bool>
Returns whether this peeker seems to be reading from a stream having CRLF newlines.
Sourcepub fn peek_byte_record(&mut self) -> Result<&ByteRecord>
pub fn peek_byte_record(&mut self) -> Result<&ByteRecord>
Attempt to read the first record of the stream without consuming related bytes.
Sourcepub fn peek(&mut self) -> Result<&[u8]>
pub fn peek(&mut self) -> Result<&[u8]>
Attempt to return the first record of the stream as bytes without consuming them.
pub fn into_reader(self) -> Chain<Cursor<Vec<u8>>, R>
Auto Trait Implementations§
impl<R> Freeze for Peeker<R>where
R: Freeze,
impl<R> RefUnwindSafe for Peeker<R>where
R: RefUnwindSafe,
impl<R> Send for Peeker<R>where
R: Send,
impl<R> Sync for Peeker<R>where
R: Sync,
impl<R> Unpin for Peeker<R>where
R: Unpin,
impl<R> UnsafeUnpin for Peeker<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for Peeker<R>where
R: 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