4 ms·
I'm not familiar with Rust, but I assume the class contains a special cloning method Yes, the Clone trait is implemented for HashMap. These are simplified exam
by danieldk 10y ago
I'm not familiar with Rust, but I assume the class contains a special cloning method
Yes, the Clone trait is implemented for HashMap. These are simplified examples to show the problem. I posted the example on which the example in the blog was based [0]. In the actual setting where I encountered this I wasn't copying a Hash{Map,Set}, as one would obviously use Clone. I was constructing a new HashMap that had the same keys as the original HashMap, but different values (both in value and type). Since this is quite a common scenario, quadratic complexity is bad.
[0]https://github.com/rust-lang/rust/issues/36481#issuecomment-258247661 https://github.com/rust-lang/rust/issues/36481#issuecomment-...