Oof, I wasted a good hour+ trying to convert from one to the other. Maybe there's an easy way to do this, but not many people on IRC knew (or were available at the time).
Re:“Python's batteries are leaking”
by edflsafoiewq on Saturday May 18, 2019 @04:28PM
(#19949559)
use std::iter::FromIterator;
BTreeMap::from_iter(hash_map.into_iter())
Re:“Python's batteries are leaking”
by steveklabnik on Saturday May 18, 2019 @05:54PM
(#19949946)
Or .into_iter().collect(), I believe. No import needed.
Re:“Python's batteries are leaking”
by a1369209993 on Saturday May 18, 2019 @06:12PM
(#19950017)
Assuming the keys are Hash + Ord, wouldn't that just be:
for (k,v) in &src
{ dst.insert(k,v); }
?Yes, that's what I ended up doing, but the error confused me and I ended up looking for a less hacky way for more than an hour until I said "fuck it" and just did that.
Re:“Python's batteries are leaking”
by new4thaccount on Saturday May 18, 2019 @03:46PM
(#19949355)
At least the first one seems pretty straightforward and thanks for replying. I only just started and have a lot to learn.
https://doc.rust-lang.org/std/collections/struct.HashMap.htm... https://doc.rust-lang.org/std/collections/struct.BTreeMap.ht...