//! Your task is to implement `evaluate` for `Map`, and define the `square` //! closure. struct Map where F: Fn(i32) -> i32, { data: Vec, mapper: F, } impl Map where F: Fn(i32) -> i32, { fn new(data: Vec, mapper: F) -> Self { Self { data, mapper } } /// Maps each element in `data` using `mapper` in-place fn evaluate(&mut self) { // TODO } fn into_vec(self) -> Vec { self.data } } #[test] fn main() { let square = |_| ___; let mut map = Map::new(vec![1, 2, 3, 4], square); map.evaluate(); map.evaluate(); assert_eq!(map.into_vec(), [1, 16, 81, 256]); }