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
use polars::prelude::*;

pub trait IterFromColumn<'a> {
    type RawInner;
    fn create_iter(column: &'a Column) -> PolarsResult<Box<dyn Iterator<Item = Option<Self::RawInner>> + 'a>>
    where
        Self: Sized;

    fn get_value(polars_value: Option<Self::RawInner>, column_name: &str, dtype: &DataType) -> PolarsResult<Self>
    where
        Self: Sized;

    #[inline]
    fn unexpected_null_value_error(column_name: &str) -> PolarsError {
        polars_err!(SchemaMismatch: "Found unexpected None/null value in column {column_name} with mandatory values!")
    }
}