Re:Rust framework actix and actix-web are dead
by atoav on Monday January 20, 2020 @01:54AM
(#22096862)
I code with Rust for roughly two years and I must say I never once needed a unsafe block. If people are using unsafe blocks over and over, they are either working on the lowest layer of abstraction or they are still stuck in different ptogramming languages and didn't know about the wonderful solutions Rust has to offer if you let it.
I always like to translate unsafe in my head to "trust me I checked this very thoroughly" — if there are indicators that the author doesn't deserve that trust, I just won't use their stuff.
Rust can be very safe, but you should really program on all levels. Check and abstract common low level magic you need into a libray and write extensive tests for it. Then use it from a high level.
Unsafe blocks are not per se a bad thing (in fact, they are needed to solve certain things efficiently), just make sure you really know why you need it and what you do within it.
I always like to translate unsafe in my head to "trust me I checked this very thoroughly" — if there are indicators that the author doesn't deserve that trust, I just won't use their stuff.
Rust can be very safe, but you should really program on all levels. Check and abstract common low level magic you need into a libray and write extensive tests for it. Then use it from a high level.
Unsafe blocks are not per se a bad thing (in fact, they are needed to solve certain things efficiently), just make sure you really know why you need it and what you do within it.