4 ms·
> Rust requires unsafe code to implement any non-trivial data structures That seems like a gross overstatement. https://github.com/rust-lang/rust/blob/master/
by jbboehr 3y ago
> Rust requires unsafe code to implement any non-trivial data structures
That seems like a gross overstatement.
https://github.com/rust-lang/rust/blob/master/library/std/src/collections/hash/map.rs https://github.com/rust-lang/rust/blob/master/library/std/sr...
CTRL-F: unsafe
Only one result, an optional utility function: "pub unsafe fn get_many_unchecked_mut"
- duckerude 3y agoThat's a wrapper around the actual implementation (which lives in an external package). Notice "use hashbrown::hash_map as base;" at the top. There's far more unsafe there: https://github.com/rust-lang/hashbrown/blob/f2e62124cd947b5e2309dd6a24c7e422932aae97/src/raw/mod.rs https://github.com/rust-lang/hashbrown/blob/f2e62124cd947b5e...