I recently discovered std::cell::Ref::map, which is a wonderful function for creating accessors for data inside a
RefCell. I am now wondering if there is any way to get an
impl Iterator out of a
RefCell in some way. I’m running into trouble due to the fact that although
Deref into an
Iterator type, that doesn’t make the
Ref itself an
Iterator. Here is a playground version of my attempt at this.
Any idea how I could achieve this? Obviously, I could return a
Ref<ExplicitIteratorType>, but that leaks my implementation (and has a very long type), or requires me to create a wrapper struct, which is also a nuisance.