MCPcopy Index your code
hub / github.com/RustPython/RustPython / try_fold_keys

Method try_fold_keys

crates/vm/src/dict_inner.rs:649–658  ·  view source on GitHub ↗
(&self, init: Acc, f: Fold)

Source from the content-addressed store, hash-verified

647 }
648
649 pub fn try_fold_keys<Acc, Fold>(&self, init: Acc, f: Fold) -> PyResult<Acc>
650 where
651 Fold: FnMut(Acc, &PyObject) -> PyResult<Acc>,
652 {
653 self.read()
654 .entries
655 .iter()
656 .filter_map(|v| v.as_ref().map(|v| v.key.as_object()))
657 .try_fold(init, f)
658 }
659
660 /// Lookup the index for the given key.
661 #[cfg_attr(feature = "flame-it", flame("Dict"))]

Callers 1

hashMethod · 0.80

Calls 5

iterMethod · 0.45
readMethod · 0.45
mapMethod · 0.45
as_refMethod · 0.45
as_objectMethod · 0.45

Tested by

no test coverage detected