summaryrefslogtreecommitdiffstats
path: root/vendor/datafrog/src/map.rs
blob: 1a8c1012834131076315ce599dcd384c79b84c35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Map functionality.

use super::{Relation, Variable};

pub(crate) fn map_into<T1: Ord, T2: Ord>(
    input: &Variable<T1>,
    output: &Variable<T2>,
    logic: impl FnMut(&T1) -> T2,
) {
    let results: Vec<T2> = input.recent.borrow().iter().map(logic).collect();

    output.insert(Relation::from_vec(results));
}