Re:“Python's batteries are leaking”
by StavrosK on Saturday May 18, 2019 @03:55PM
(#19949398)
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).
[ Parent
| on HN ]
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); }
?