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

Method __iter__

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

Source from the content-addressed store, hash-verified

43#[pyproto]
44impl PyIterProtocol for PyCowMap {
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 (k, v) in this.as_ref().iter() {
51 elements.push((k.to_object(py), from_data(py, &v.clone())?));
52 }
53
54 Ok(super::iterator::PyObjectPairIterator::new(
55 elements.into_iter(),
56 ))
57 }
58}

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