Kimundi / owning-ref-rs

A library for creating references that carry their owner with them.
MIT License
359 stars 50 forks source link

adding support for map_with_owner #51

Closed idubrov closed 4 years ago

idubrov commented 4 years ago

Adding support for map_with_owner which is the same as regular map, but also gives a reference to the owner itself.

idubrov commented 4 years ago

This functionality would be helpful for "recursive" data structures represented via trees where you sometimes need to return back to the "root" from leaf nodes.

idubrov commented 4 years ago

Updated; not sure what kind of tests should I write, so I just did pretty much the same test as in doctests.

avitex commented 4 years ago

Thanks again :+1: The feature added is great, might just change one of the tests :)