Struct csvsc::input::InputStream
source · [−]pub struct InputStream { /* private fields */ }
Expand description
A structure for creating a transformation chain from input files.
Most of the time you’ll start your processing chain using .from_readers()
or .from_paths()
and then chain the methods of the
RowStream
trait. However there are more options
for the cases where you need to customize how your input is read.
Trait Implementations
sourceimpl IntoIterator for InputStream
impl IntoIterator for InputStream
sourceimpl RowStream for InputStream
impl RowStream for InputStream
sourcefn headers(&self) -> &Headers
fn headers(&self) -> &Headers
Must return headers as they are in this point of the chain. For example
if implementor adds a column, its headers()
function must return the
new headers including the one just added. Read more
sourcefn add(self, column: ColSpec) -> Result<Add<Self>> where
Self: Sized,
fn add(self, column: ColSpec) -> Result<Add<Self>> where
Self: Sized,
Add a column to each row of the stream. Read more
sourcefn del(self, columns: Vec<&str>) -> Del<'_, Self> where
Self: Sized,
fn del(self, columns: Vec<&str>) -> Del<'_, Self> where
Self: Sized,
Deletes the specified columns from each row of the stream. If you have
too many columns to delete perhaps instead use RowStream::select
. Read more
sourcefn select(self, columns: Vec<&str>) -> Select<'_, Self> where
Self: Sized,
fn select(self, columns: Vec<&str>) -> Select<'_, Self> where
Self: Sized,
Outputs only the selected columns, ignoring the rest. Read more
sourcefn add_with<F>(
self,
colname: &str,
f: F
) -> Result<AddWith<Self, F>, BuildError> where
Self: Sized,
F: FnMut(&Headers, &Row) -> Result<String>,
fn add_with<F>(
self,
colname: &str,
f: F
) -> Result<AddWith<Self, F>, BuildError> where
Self: Sized,
F: FnMut(&Headers, &Row) -> Result<String>,
Adds a column to each row of the stream using a closure to compute its value. Read more
sourcefn reduce(self, columns: Vec<Box<dyn Aggregate>>) -> Result<Reduce<Self>> where
Self: Sized,
fn reduce(self, columns: Vec<Box<dyn Aggregate>>) -> Result<Reduce<Self>> where
Self: Sized,
Reduce all the incoming stream into one row, computing some aggregates in the way. All the stream collapses into one row. Read more
sourcefn adjacent_group<F, R, G>(self, grouping: G, f: F) -> AdjacentGroup<Self, F, G> where
F: Fn(MockStream<IntoIter<RowResult>>) -> R,
R: RowStream,
G: GroupCriteria,
Self: Sized,
fn adjacent_group<F, R, G>(self, grouping: G, f: F) -> AdjacentGroup<Self, F, G> where
F: Fn(MockStream<IntoIter<RowResult>>) -> R,
R: RowStream,
G: GroupCriteria,
Self: Sized,
Groups rows by the given criteria, but assuming a “group” is a set of adjacent rows. Read more
sourcefn group<F, R, G>(self, grouping: G, f: F) -> Group<Self, F, G> where
F: Fn(MockStream<IntoIter<RowResult>>) -> R,
R: RowStream,
G: GroupCriteria,
Self: Sized,
fn group<F, R, G>(self, grouping: G, f: F) -> Group<Self, F, G> where
F: Fn(MockStream<IntoIter<RowResult>>) -> R,
R: RowStream,
G: GroupCriteria,
Self: Sized,
Groups rows by the given criteria. You’ll be given a RowStream instance as the first argument of a closure that you can use to further process the grouped rows. Read more
sourcefn flush<T>(self, target: T) -> Result<Flush<Self, T>> where
Self: Sized,
fn flush<T>(self, target: T) -> Result<Flush<Self, T>> where
Self: Sized,
When consumed, writes to destination specified by the column given in
the first argument. Other than that this behaves like an id(x)
function so you can specify more links in the chain and even more
flushers. Read more
sourcefn review<F>(self, f: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Headers, &RowResult),
fn review<F>(self, f: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Headers, &RowResult),
Mostly for debugging, calls a closure on each element. Behaves like the identity function on the stream returning each row untouched. Read more
sourcefn rename(self, old_name: &str, new_name: &str) -> Rename<Self> where
Self: Sized,
fn rename(self, old_name: &str, new_name: &str) -> Rename<Self> where
Self: Sized,
Renames some columns
sourcefn map_row<F, H, R>(self, f: F, header_map: H) -> MapRow<Self, F> where
Self: Sized,
F: Fn(&Headers, &Row) -> Result<R>,
H: Fn(&Headers) -> Headers,
R: Iterator<Item = RowResult>,
fn map_row<F, H, R>(self, f: F, header_map: H) -> MapRow<Self, F> where
Self: Sized,
F: Fn(&Headers, &Row) -> Result<R>,
H: Fn(&Headers) -> Headers,
R: Iterator<Item = RowResult>,
Apply a function to every row and use the return values to build the row stream. Read more
sourcefn map_col<F>(self, col: &str, f: F) -> MapCol<Self, F> where
Self: Sized,
F: Fn(&str) -> Result<String>,
fn map_col<F>(self, col: &str, f: F) -> MapCol<Self, F> where
Self: Sized,
F: Fn(&str) -> Result<String>,
Apply a function to a single column of the stream, this function dones’t fail if the column dones’t exist. Read more
Auto Trait Implementations
impl !RefUnwindSafe for InputStream
impl Send for InputStream
impl Sync for InputStream
impl Unpin for InputStream
impl !UnwindSafe for InputStream
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more