pub struct Reader<R> { /* private fields */ }Expand description
An already configured copying/unescaping CSV reader.
§Configuration
To configure a Reader, if you need a custom delimiter for instance of if
you want to tweak the size of the inner buffer. Check out the
ReaderBuilder.
Implementations§
Source§impl<R: Read> Reader<R>
impl<R: Read> Reader<R>
Sourcepub fn from_reader(reader: R) -> Self
pub fn from_reader(reader: R) -> Self
Create a new reader 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 reader has been configured to interpret the first record as a header.
Sourcepub fn byte_headers(&mut self) -> Result<&ByteRecord>
pub fn byte_headers(&mut self) -> Result<&ByteRecord>
Attempt to return a reference to this reader’s first record.
Sourcepub fn read_byte_record(&mut self, record: &mut ByteRecord) -> Result<bool>
pub fn read_byte_record(&mut self, record: &mut ByteRecord) -> Result<bool>
Attempt to read the next CSV record into a pre-allocated ByteRecord.
Returns a boolean indicating whether a record was actually read or if we reached the end of the stream.
Sourcepub fn byte_records(&mut self) -> ByteRecordsIter<'_, R>
pub fn byte_records(&mut self) -> ByteRecordsIter<'_, R>
Return an iterator yielding ByteRecord structs.
Sourcepub fn into_byte_records(self) -> ByteRecordsIntoIter<R>
pub fn into_byte_records(self) -> ByteRecordsIntoIter<R>
Transform the reader into an iterator yielding ByteRecord structs.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwrap into the underlying reader.
BEWARE: any already buffered data will be lost!
Sourcepub fn into_bufreader(self) -> (Option<ByteRecord>, BufReader<R>)
pub fn into_bufreader(self) -> (Option<ByteRecord>, BufReader<R>)
Unwrap into an optional first record (only when the reader was
configured not to interpret the first record as a header, and when the
first record was pre-buffered but not yet reemitted), and the underlying
BufReader.