rust error

Rust groups errors into two major categories: recoverable and unrecoverable errors.

Rust doesn’t have exceptions. Instead, it has the type Result<T, E> for recoverable errors and the panic! macro that stops execution when the program encounters an unrecoverable error.

By default, when a panic occurs, the program starts unwinding, which means Rust walks back up the stack and cleans up the data from each function it encounters. But this walking back and cleanup is a lot of work.
If in your project you need to make the resulting binary as small as possible, you can switch from unwinding to aborting

1
2
[profile.release]
panic = 'abort'