Implementing iterator on a nested RefCell, is it possible?

Hierarchical RefCells are difficult to iterate in the canonical ways because you have to maintain the entire chain of ownership in the form of Refs. Consider internal iteration. Or you can perhaps collect a Vec<Ref<_>> first (but then you lose out on some of the benefits of iteration).

See this recentish thread and also this chapter of Too Many Linked Lists.

2 Likes