unsafe_unwrap

Crates.iounsafe_unwrap
lib.rsunsafe_unwrap
version0.1.0
sourcesrc
created_at2017-07-12 14:07:29.572418
updated_at2017-08-02 14:52:22.704919
descriptionUnsafely unwrap Result and Option types without checking.
homepagehttps://github.com/nvzqz/unsafe-unwrap-rs
repositoryhttps://github.com/nvzqz/unsafe-unwrap-rs
max_upload_size
id23128
size19,268
Nikolai Vazquez (nvzqz)

documentation

README

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 unsafe_unwrap::UnsafeUnwrap;

let x = Some(42);
let y = unsafe { x.unsafe_unwrap() };

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.

Commit count: 8

cargo fmt