extern crate qindex_multi; extern crate vec_map; use vec_map::VecMap; use qindex_multi::{MultiIndexable, MultiIndex}; #[test] fn test1(){ let mut data = VecMap::new(); data.insert(0, 100u16); data.insert(2, 200); data.insert(20, 300); data.insert(200, 400); let read_indicies = vec![0usize, 2, 20]; let write_indicies = vec![200usize]; let multi_idx = MultiIndex::new(read_indicies, write_indicies); { let mut output = data.index_multi(&multi_idx); let (a, b, c) = (output.read.next().unwrap(), output.read.next().unwrap(), output.read.next().unwrap()); let d = output.write.next().unwrap(); *d += *a + *b + c; } assert_eq!(data[200], 1000); }