Last active
August 11, 2019 23:02
-
-
Save lissahyacinth/0999c225a7936155cb1cfd31c5fb7400 to your computer and use it in GitHub Desktop.
RustDyn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn map_column<'a, ColumnType: 'static, A: 'static, B: 'static>( | |
column_data: &'a ColumnInformation<ColumnType>, | |
column_idx: usize, | |
indexes: &[usize], | |
map_fn: A, | |
) -> Box<dyn Iterator<Item = B> + 'a> | |
where | |
A: Fn(ColumnType) -> B, | |
ColumnType: std::clone::Clone, | |
{ | |
let column_indexes: Vec<usize> = indexes | |
.iter() | |
.map(|idx| (column_data.columns * *idx) + column_idx) | |
.collect::<Vec<usize>>(); | |
Box::new( | |
column_indexes | |
.into_iter() | |
.map(move |index| map_fn(column_data.predictors[index].clone())), | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment