4 ms·
Are there examples where unsafe Rust is a must?
by Alifatisk 3y ago
Are there examples where unsafe Rust is a must?
- pohl 3y agoThe 3rd paragraph has 3 bullet points about it.
- Alifatisk 3y agoI know, but I'd like to read some input from the HN crowd aswell.
- Ygg2 3y agoSure. Accessing C FFI. Calling low level code like asm!, SIMD and so on. You'll never be able to truly escape it, just mostly. -- One interesting suggestion by matthieum on Reddit was to make previously safe fn unsafe.
- rowanG077 3y agoThere quite a few APIs which do not have safe wrappers. Recently I needed to disable IP fragmentation on a socket. I had to invoke the raw c library which is unsafe.
- ostenning 3y agoDMA, because the buffer can be linked to a designated RAM section, and it needs to be declared as a static mutable. There would be many examples when code is running at lower levels with no OS abstraction