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

Function iter

cranelift/entity/src/primary.rs:416–441  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

414
415 #[test]
416 fn iter() {
417 let mut m: PrimaryMap<E, usize> = PrimaryMap::new();
418 m.push(12);
419 m.push(33);
420
421 let mut i = 0;
422 for (key, value) in &m {
423 assert_eq!(key.index(), i);
424 match i {
425 0 => assert_eq!(*value, 12),
426 1 => assert_eq!(*value, 33),
427 _ => panic!(),
428 }
429 i += 1;
430 }
431 i = 0;
432 for (key_mut, value_mut) in m.iter_mut() {
433 assert_eq!(key_mut.index(), i);
434 match i {
435 0 => assert_eq!(*value_mut, 12),
436 1 => assert_eq!(*value_mut, 33),
437 _ => panic!(),
438 }
439 i += 1;
440 }
441 }
442
443 #[test]
444 fn iter_rev() {

Callers 2

custom_resultFunction · 0.50
executeMethod · 0.50

Calls 3

newFunction · 0.50
pushMethod · 0.45
iter_mutMethod · 0.45

Tested by

no test coverage detected