pub struct CsvStreamReader {
pub path: String,
pub config: CsvStreamConfig,
pub position: u64,
pub chunk_id: usize,
/* private fields */
}Expand description
A streaming CSV reader that yields data in fixed-size chunks.
Fields§
§path: StringPath to the CSV file.
config: CsvStreamConfigConfiguration used by this reader.
position: u64Byte offset of the next chunk start (after the header).
chunk_id: usizeIdentifier of the next chunk to be returned.
Implementations§
Source§impl CsvStreamReader
impl CsvStreamReader
Sourcepub fn open(path: &str, config: CsvStreamConfig) -> Result<Self>
pub fn open(path: &str, config: CsvStreamConfig) -> Result<Self>
Open a CSV file for streaming.
Sourcepub fn n_columns(&self) -> Option<usize>
pub fn n_columns(&self) -> Option<usize>
Number of columns (known only after the header has been read or the first row has been parsed).
Sourcepub fn next_chunk(&mut self) -> Result<Option<CsvChunk>>
pub fn next_chunk(&mut self) -> Result<Option<CsvChunk>>
Read the next chunk of rows.
Returns Ok(None) when the file is exhausted.
Auto Trait Implementations§
impl Freeze for CsvStreamReader
impl RefUnwindSafe for CsvStreamReader
impl Send for CsvStreamReader
impl Sync for CsvStreamReader
impl Unpin for CsvStreamReader
impl UnsafeUnpin for CsvStreamReader
impl UnwindSafe for CsvStreamReader
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.