A crate with some utility methods for debug unchecked operations on Option
, Result
and slice
/ str
,
as well as a debug unreachable!
alternative.
A middle ground between someting like
- calling
Option::unwrap()
/Result::unwrap()
/ slice/string square brackets indexing operator, or usingunreachable!
, which always panic ifNone
/Err
/ out of bounds / reached, and - unsafe
Option::unwrap_unchecked()
Result::unwrap_unchecked()
/[T]::get_unchecked()
, or usingunreachable_unchecked()
, which never panic and lead to UB whenNone
/Err
/ out of bounds,
an operation which does unsafe access in release configuration, for optimal codegen if the invariants are maintained by other means,
but also panics on None
/ Err
/ out of bounds index in debug configuration / when running tests.