#unwrap #unsafe #result #options

no-std unsafe_unwrap

Unsafely unwrap Result and Option types without checking

1 unstable release

Uses old Rust 2015

0.1.0 Jul 12, 2017

#237 in No standard library

Download history 3527/week @ 2024-12-11 3279/week @ 2024-12-18 826/week @ 2024-12-25 2013/week @ 2025-01-01 2823/week @ 2025-01-08 4170/week @ 2025-01-15 4907/week @ 2025-01-22 5423/week @ 2025-01-29 5408/week @ 2025-02-05 5102/week @ 2025-02-12 4236/week @ 2025-02-19 4313/week @ 2025-02-26 5317/week @ 2025-03-05 3989/week @ 2025-03-12 7043/week @ 2025-03-19 7304/week @ 2025-03-26

24,246 downloads per month
Used in 55 crates (8 directly)

MIT/Apache

8KB
87 lines

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.

No runtime deps