Rower

Trait Rower 

Source
pub trait Rower {
    // Required methods
    fn visit(&mut self, row: &Row) -> bool;
    fn join(self, other: Self) -> Self;
}
Expand description

A trait for visitors who iterate through and process each row of a data frame.

Required Methods§

Source

fn visit(&mut self, row: &Row) -> bool

This function is called once per row of a data frame. The return value is used in filter methods to indicate whether a row should be kept, and is meaningless when using map.

§Data Frame Mutability

Since the row that is visited is only an immutable reference, it is impossible to mutate a data frame via map/filter since you can’t mutate each Row when visiting them. If you wish to get around this (purposeful) limitation, you may define a Rower that has a LocalDataFrame for one of its fields. Then, in your visit implementation, you may clone each Row as you visits them, mutate them, then adds it to your Rower’s copy of the LocalDataFrame. This way you will have the original and the mutated copy after map/filter.

Source

fn join(self, other: Self) -> Self

In all cases, except when using single-threaded map with a LocalDataFrame, the Rowers being executed in separate threads or machines will need to be joined and combined to obtain the final result. This may be as simple as adding up each Rowers sum to get a total sum or may be much more complicated. In most cases, it is usually trivial. The returned Rower will contain the final results.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§