3 ms·
To the contrary I ran into cases pretty quickly that rust just wasn't useful for in my opinion. One of my use cases was something like a mutable borrow of an s
by jpc0 3y ago
To the contrary I ran into cases pretty quickly that rust just wasn't useful for in my opinion.
One of my use cases was something like a mutable borrow of an struct in a struct in a single threaded code path wasn't allowed because the entire struct was mutably borrowed or some nonsense.
I believe the "idiomatic" way was to create some weird abstraction to appease the borrow checker that the thing being borrowed once is only being borrowed once.
I rewrote the code in C++ and never looked back.
- lenkite 3y agoFrom what I have observed, most advanced Rust authors don't bother with lifetimes at all. Every pointer becomes an integer index into some slice and they mostly skip the lifetime/borrow checking. Lifetime are only kept on the few, easy-to-reason about cases. Kind of funny actually.
- duped 3y agoForbidding multiple mutable borrows is how Rust is able to prevent you from writing code with bugs like iterator invalidation. Has nothing to do with threading.