3 ms·
Thanks. So, I'm not sure what _specifically_ the issue is here with PartialOrd. It has 'impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V>', and i
by steveklabnik 12y ago
Thanks. So, I'm not sure what _specifically_ the issue is here with PartialOrd. It has 'impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V>', and if you click on PartialOrd, you go to https://doc.rust-lang.org/core/cmp/trait.PartialOrd.html https://doc.rust-lang.org/core/cmp/trait.PartialOrd.html, which has an explanation of what it does. Am I missing something?
ChaChaRng _does_ mention OsRng, but a code sample might help, for sure.
- Veedrac 12y ago> I'm not sure what _specifically_ the issue is here with PartialOrd. I know what a partial order is, I just don't know what partial order maps realize. In Python they aren't orderable. > ChaChaRng _does_ mention OsRng It says to use OsRng if cryptographic security is needed, not how to seed with it. The obvious way is something like let osrng = OsRng::new().unwrap(); let mut key = [0u32; 8]; for word in key.iter_mut() { *word = osrng.gen(); } let prng = ChaChaRng::from_seed(&key[..]) which is a pain.
- steveklabnik 12y agoRoger, I see what you're saying, on both counts. Thank you for taking the time to spell it out to me.
- dbaupp 12y agoMaps can be compared lexicographically. BTreeMap and VecMap have a canonical order in which they store their elements so iter::order::cmp(self.iter(), other.iter()) works as an ordering. HashMap in Rust (dict in Python) doesn't have a canonical ordering of elements, so this doesn't make sense.