Replace Node.foreach_child() with a Node.iter_children()
Currently we have a Node.foreach_child()
method to which one passes a closure; this closure will be invoked for each child node and stop if one call returns false
. This lets the caller "find" a child node and stop iteration when it does.
It would be more Rusty to have an iterator instead. We should replace this function with a Node.iter_children()
which returns something that implements Iterator
. Callers can then exit their for
loop or whatever when they need.
The C code makes use of rsvg_node_foreach_child()
, which just wraps Node.foreach_child()
with a C-friendly function. We can leave that one like it is, maybe converting its implementation into using the iterator. Alternatively, we can provide an iteration API for the C code to use, similar to rsvg_property_bag_iter_begin()
/rsvg_property_bag_iter_next()
/rsvg_property_bag_iter_end()
.