MCPcopy Index your code
hub / github.com/QMHTMY/RustBook / iter

Method iter

publication/code/chapter06/hashmap.rs:181–188  ·  view source on GitHub ↗

为 hashmap 实现的迭代及可变迭代功能

(&self)

Source from the content-addressed store, hash-verified

179
180 // 为 hashmap 实现的迭代及可变迭代功能
181 fn iter(&self) -> Iter<T> {
182 let mut iterator = Iter { stack: Vec::new() };
183 for item in self.data.iter() {
184 iterator.stack.push(item);
185 }
186
187 iterator
188 }
189
190 fn iter_mut(&mut self) -> IterMut<T> {
191 let mut iterator = IterMut { stack: Vec::new() };

Callers 3

lenMethod · 0.45
is_emptyMethod · 0.45
iterFunction · 0.45

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected