pub struct MockStream<I> { /* private fields */ }
Expand description
A simple struct that helps create RowStreams from vectors.
Implementations§
Source§impl<I> MockStream<I>
impl<I> MockStream<I>
Sourcepub fn new(iter: I, headers: Headers) -> MockStream<I>
pub fn new(iter: I, headers: Headers) -> MockStream<I>
Creates a new object implementing the RowStream trait from an iterator and some headers.
Sourcepub fn from_rows(iter: I) -> Result<MockStream<I>, BuildError>
pub fn from_rows(iter: I) -> Result<MockStream<I>, BuildError>
Creates a new object implementing the RowStream trait from an iterator of RowResult objects, the first of which must be the header row.
Trait Implementations§
Source§impl<I: Debug> Debug for MockStream<I>
impl<I: Debug> Debug for MockStream<I>
Source§impl<I> IntoIterator for MockStream<I>
impl<I> IntoIterator for MockStream<I>
Source§impl<I> RowStream for MockStream<I>
impl<I> RowStream for MockStream<I>
Source§fn 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.Source§fn 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
Source§fn 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
.Source§fn 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
Source§fn add_with<F>(
self,
colname: &str,
f: F,
) -> Result<AddWith<Self, F>, BuildError>
fn add_with<F>( self, colname: &str, f: F, ) -> Result<AddWith<Self, F>, BuildError>
Adds a column to each row of the stream using a closure to compute its
value. Read more
Source§fn 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
Source§fn adjacent_group<F, R, G>(self, grouping: G, f: F) -> AdjacentGroup<Self, F, G>
fn adjacent_group<F, R, G>(self, grouping: G, f: F) -> AdjacentGroup<Self, F, G>
Groups rows by the given criteria, but assuming a “group” is a set of
adjacent rows. Read more
Source§fn group<F, R, G>(self, grouping: G, f: F) -> Group<Self, F, G>
fn group<F, R, G>(self, grouping: G, f: F) -> Group<Self, F, G>
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
Source§fn 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.Source§fn review<F>(self, f: F) -> Inspect<Self, F>
fn review<F>(self, f: F) -> Inspect<Self, F>
Mostly for debugging, calls a closure on each element. Behaves like the
identity function on the stream returning each row untouched.
Source§fn 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
Source§fn map_row<F, H, R>(self, f: F, header_map: H) -> MapRow<Self, F>
fn map_row<F, H, R>(self, f: F, header_map: H) -> MapRow<Self, F>
Apply a function to every row and use the return values to build the
row stream. Read more
Source§fn map_col<F>(self, col: &str, f: F) -> MapCol<Self, F>
fn map_col<F>(self, col: &str, f: F) -> MapCol<Self, F>
Apply a function to a single column of the stream, this function dones’t fail
if the column dones’t exist.
Source§fn filter_col<F>(self, col: &str, f: F) -> Result<FilterCol<Self, F>>
fn filter_col<F>(self, col: &str, f: F) -> Result<FilterCol<Self, F>>
filter entire rows out depending on one column’s value and a
condition, leaving errored rows untouched.
Auto Trait Implementations§
impl<I> Freeze for MockStream<I>where
I: Freeze,
impl<I> RefUnwindSafe for MockStream<I>where
I: RefUnwindSafe,
impl<I> Send for MockStream<I>where
I: Send,
impl<I> Sync for MockStream<I>where
I: Sync,
impl<I> Unpin for MockStream<I>where
I: Unpin,
impl<I> UnwindSafe for MockStream<I>where
I: 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