2 ms·
In theory, yes, but I spend most of my time on what's most important, which is the stuff in-tree. I've even been neglecting Cargo, which could use a reorganizai
by steveklabnik 12y ago
In theory, yes, but I spend most of my time on what's most important, which is the stuff in-tree. I've even been neglecting Cargo, which could use a reorganizaiton at least.
Those implementations should absolutely be in the generated documentation, can you maybe point me to some specific pages? Thanks :)
- Veedrac 12y agoThe two maps with PartialOrd are https://doc.rust-lang.org/collections/struct.BTreeMap.html https://doc.rust-lang.org/collections/struct.BTreeMap.html https://doc.rust-lang.org/collections/vec_map/struct.VecMap.html https://doc.rust-lang.org/collections/vec_map/struct.VecMap.... ChaChaRng is http://doc.rust-lang.org/rand/rand/chacha/struct.ChaChaRng.html http://doc.rust-lang.org/rand/rand/chacha/struct.ChaChaRng.h... although the other implementations also need this. The main page for rand should probably have this somewhere on it, too. Thanks for helping :).
- steveklabnik 12y agoThanks. 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.