I started moving from C++ to Rust recently. I’m not sure about the unsafe usage style.
You see, Rust provides “unsafe fn” and “unsafe block”. If not for FFI or unsafe trait, I can simply wrap the whole implementation of an unsafe function to avoid the unsafe tag before function. I think this is OK because the callers will not bother adding “unsafe” to their code.
But as I learn from many Rust projects, I find that there are so many functions marked as unsafe instead of using unsafe block. This is quite strange to me as they seem to neglect a safe wrapper. Are there any specific rules regarding the choice between “unsafe fn” and “unsafe block”?