Crates.io | unsafe_unwrap |
lib.rs | unsafe_unwrap |
version | 0.1.0 |
source | src |
created_at | 2017-07-12 14:07:29.572418 |
updated_at | 2017-08-02 14:52:22.704919 |
description | Unsafely unwrap Result and Option types without checking. |
homepage | https://github.com/nvzqz/unsafe-unwrap-rs |
repository | https://github.com/nvzqz/unsafe-unwrap-rs |
max_upload_size | |
id | 23128 |
size | 19,268 |
A Rust library that enables unchecked unwrapping on Option
and Result
types.
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 unsafe_unwrap::UnsafeUnwrap;
let x = Some(42);
let y = unsafe { x.unsafe_unwrap() };
bench_normal_unwrap_1000 |
bench_unsafe_unwrap_1000 |
---|---|
929 ns/iter (+/- 176) | 302 ns/iter (+/- 28) |
This project is released under either:
at your choosing.