3 ms·
> But there are too many places where something can go wrong to try and enforce deliberate error-handling everywhere Rust actually defines APIs to do just that
by bennettnate5 2y ago
> But there are too many places where something can go wrong to try and enforce deliberate error-handling everywhere
Rust actually defines APIs to do just that. Integer overflows can be handled with the `checked_add`
family of functions. Indexing can be handled with `get` and `get_mut` on slices. Some choose to develop Rust libraries/projects using only APIs that explicitly cannot panic.
It's certainly not for everyone, but I find it incredible that Rust allows that option to develop code that is not only safe, but also robust against crashing the process (1).
1 - barring compiler/standard library bugs and OOM, which more so depends on the runtime