Manishearth / elsa

Append-only collections for Rust where borrows to entries can outlive insertions
Apache License 2.0
228 stars 33 forks source link

Implement something like `get_clone()` for `V: CloneStableDeref` #76

Closed LogvinovLeon closed 4 months ago

LogvinovLeon commented 4 months ago

Now if the map stores Rc<T> - one can only get &T. It will be useful to be able to get cloned Rc<T>. And it's safe as Rc is CloneStableDeref

Manishearth commented 4 months ago

I'd support this if someone wrote a PR.

LogvinovLeon commented 4 months ago

I started working on a PR and saw in examples .map_get(Clone::clone) which achieves exactly what I want. Therefore - I don't think it's worth it to clutter the interface. Let me know if you disagree and i'll still submit the PR