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

Function iter_rev

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

Source from the content-addressed store, hash-verified

442
443 #[test]
444 fn iter_rev() {
445 let mut m: PrimaryMap<E, usize> = PrimaryMap::new();
446 m.push(12);
447 m.push(33);
448
449 let mut i = 2;
450 for (key, value) in m.iter().rev() {
451 i -= 1;
452 assert_eq!(key.index(), i);
453 match i {
454 0 => assert_eq!(*value, 12),
455 1 => assert_eq!(*value, 33),
456 _ => panic!(),
457 }
458 }
459
460 i = 2;
461 for (key, value) in m.iter_mut().rev() {
462 i -= 1;
463 assert_eq!(key.index(), i);
464 match i {
465 0 => assert_eq!(*value, 12),
466 1 => assert_eq!(*value, 33),
467 _ => panic!(),
468 }
469 }
470 }
471 #[test]
472 fn keys() {
473 let mut m: PrimaryMap<E, usize> = PrimaryMap::new();

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected