[−][src]Function c2rust_refactor::util::dataflow::iterate
pub fn iterate<K, V, F>(data: &mut HashMap<K, V>, update: F) where
K: Hash + Eq + Clone + Debug,
F: FnMut(K, &mut V, &Ctxt<K, V>) -> bool,
Run an iterative worklist algorithm to find a fixed point. data
should be pre-initialized
with data for each relevant key. This function will call update(k, v, ctx)
for each node.
Use ctx[other_k]
to obtain data for other nodes.
TODO: Right now, indexing panics if other_k == k
. If we change the signature of update
to
FnMut(K, &RefactorCtxt<K, V>) -> V
then we can avoid this issue. Being unable to mutate the value
in-place might be slightly less efficient for some use cases, though.