MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / __iter__

Method __iter__

flow-message/src/cross/python/map.rs:45–60  ·  view source on GitHub ↗
(this: PyRefMut<Self>)

Source from the content-addressed store, hash-verified

43#[pyproto]
44impl PyIterProtocol for PyMap {
45 fn __iter__(this: PyRefMut<Self>) -> PyResult<super::iterator::PyObjectPairIterator> {
46 let gil = Python::acquire_gil();
47 let py = gil.python();
48
49 let mut elements = std::vec::Vec::new();
50 for pair in this.as_ref().iter() {
51 elements.push((
52 pair.key().to_object(py),
53 from_data(py, &pair.value().clone())?,
54 ));
55 }
56
57 Ok(super::iterator::PyObjectPairIterator::new(
58 elements.into_iter(),
59 ))
60 }
61}

Callers

nothing calls this directly

Calls 5

from_dataFunction · 0.85
as_refMethod · 0.80
pushMethod · 0.80
to_objectMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected