unsafe_unwrap
A Rust library that enables unchecked unwrapping on Option
and Result
types.
Usage
The unsafe_unwrap()
method can be used anywhere unwrap()
is used. It behaves
similar to unwrap()
in unoptimized builds and will remove checks in optimized
builds.
extern crate unsafe_unwrap;
use UnsafeUnwrap;
let x = Some;
let y = unsafe ;
Benchmark
bench_normal_unwrap_1000 |
bench_unsafe_unwrap_1000 |
---|---|
929 ns/iter (+/- 176) | 302 ns/iter (+/- 28) |
License
This project is released under either:
at your choosing.