polars_rows_iter/iter_from_column/
iter_from_column.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use polars::prelude::*;

pub trait IterFromColumn<'a, T> {
    fn create_iter(
        dataframe: &'a DataFrame,
        column_name: &'a str,
    ) -> PolarsResult<Box<dyn Iterator<Item = Option<T>> + 'a>>
    where
        Self: Sized;

    fn get_value(_polars_value: Option<T>, _column_name: &'a str) -> PolarsResult<Self>
    where
        Self: Sized,
    {
        // You must override this for not optional values.
        // Make sure to add the #[inline] attribute to your implementation.
        panic!("This should never be called")
    }
}