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

Function iter

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

Source from the content-addressed store, hash-verified

176
177 #[test]
178 fn iter() {
179 let mut p: PrimaryMap<E, usize> = PrimaryMap::new();
180 p.push(12);
181 p.push(33);
182 let mut m = p.into_boxed_slice();
183
184 let mut i = 0;
185 for (key, value) in &m {
186 assert_eq!(key.index(), i);
187 match i {
188 0 => assert_eq!(*value, 12),
189 1 => assert_eq!(*value, 33),
190 _ => panic!(),
191 }
192 i += 1;
193 }
194 i = 0;
195 for (key_mut, value_mut) in m.iter_mut() {
196 assert_eq!(key_mut.index(), i);
197 match i {
198 0 => assert_eq!(*value_mut, 12),
199 1 => assert_eq!(*value_mut, 33),
200 _ => panic!(),
201 }
202 i += 1;
203 }
204 }
205
206 #[test]
207 fn iter_rev() {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected