-
I believe &im::HashMap -> im::HashMap should be very cheap, no more expensive than a Rc::clone()
-
I can't figure out how to do the above.
-
Looking at map.rs.html -- source there are functions which take a &im::HashMap , does an update, and returns a im::HashMap
-
Now, suppose I want to do a number of these updates in sequence, I'd like to do:
let mut x: im::HashMap<...> = ...;
for ...
x = x.update(...)
but I can't do this right now because I can't figure out how to convert an &im::hashMap to a im::HashMap
@sfackler : tried that already. Clone not implemented.
You're right. Problem is my Value type did not have impl Clone, so I couldn't use that.
This also confuses me now -- in a persistent hashmap, if everything is shared, why does the value type need to support Clone at all?
It does look like those K: Clone, V: Clone
are both unnecessary. It only needs to clone the root
with either Ref = Rc
or Arc
.
system
Closed
7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.