MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / iter_rev

Function iter_rev

cranelift/entity/src/boxed_slice.rs:207–234  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

205
206 #[test]
207 fn iter_rev() {
208 let mut p: PrimaryMap<E, usize> = PrimaryMap::new();
209 p.push(12);
210 p.push(33);
211 let mut m = p.into_boxed_slice();
212
213 let mut i = 2;
214 for (key, value) in m.iter().rev() {
215 i -= 1;
216 assert_eq!(key.index(), i);
217 match i {
218 0 => assert_eq!(*value, 12),
219 1 => assert_eq!(*value, 33),
220 _ => panic!(),
221 }
222 }
223
224 i = 2;
225 for (key, value) in m.iter_mut().rev() {
226 i -= 1;
227 assert_eq!(key.index(), i);
228 match i {
229 0 => assert_eq!(*value, 12),
230 1 => assert_eq!(*value, 33),
231 _ => panic!(),
232 }
233 }
234 }
235 #[test]
236 fn keys() {
237 let mut p: PrimaryMap<E, usize> = PrimaryMap::new();

Callers

nothing calls this directly

Calls 5

newFunction · 0.50
pushMethod · 0.45
into_boxed_sliceMethod · 0.45
iterMethod · 0.45
iter_mutMethod · 0.45

Tested by

no test coverage detected