1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#[derive(Debug)] pub struct IndexUpdater { index_map: Vec<usize>, } impl IndexUpdater { pub fn from_map(index_map: Vec<usize>) -> Self { Self { index_map } } } impl IndexUpdater { pub fn update(&self, i: usize) -> usize { self.index_map[i] } }