I'm trying to iterator on a struct containing a Ref. Thanks to some research I managed to find a working solution. (See the
iter() function on the
The following playground show the issue: Rust Playground.
Now, I want to map that iterator and keep it inside some a struct (see the
iter_id() function of the
Shop struct. I want to iterate using my ref and adding a mapping to each elements. Sadly I struggle a lot with this approach. For instance I can't write the type of IntoIter on the
ItemsId implementation because it requires
std::iter::Map and I don't know how to write the lambda part of the Map iterator.
Note that I don't want to allocate any vectors.
Thanks for the help.