by AstralStorm · 9y ago · 0 comments
Traits, while cool, ate not potent enough at times.
I'm not sure where one would get the idea that `unsafe` would be entirely forbidden in idiomatic Rust. "Idiomatic" Rust acknowledges the danger and subtle pitfalls of unsafe code, and thereby discourages the use of `unsafe`, but also acknowledges that it is still possible to build safe abstractions out of internally-unsafe code.
> in order to get similar performance to C++ data structures
By Rust's definition, every line of code in a C++ codebase counts as unsafe code. :P If Rust can get equivalent performance to C++ while only using exposing 1% of the code to unsafety, that's an enormous win.
This is just not true. Unsafe != performance. sometimes it does, but not always. For example, the Benchmarks Game programs that are currently fastest have very little unsafe, one of them is entirely for FFI to GMP. Several 100% safe programs have replaced slower programs that used unsafe.