polars_rows_iter/from_dataframe_row.rs
1use std::collections::HashMap;
2
3use polars::prelude::*;
4
5pub trait ColumnNameBuilder<'a> {
6 fn build(self) -> HashMap<&'a str, &'a str>;
7}
8
9pub trait FromDataFrameRow<'a> {
10 type Builder: ColumnNameBuilder<'a>;
11 fn from_dataframe(
12 dataframe: &'a DataFrame,
13 columns: HashMap<&str, &str>,
14 ) -> PolarsResult<Box<dyn Iterator<Item = PolarsResult<Self>> + 'a>>
15 where
16 Self: Sized;
17
18 fn create_builder() -> Self::Builder;
19}