[][src]Crate unchecked_unwrap

unchecked_unwrap

Crates.io Deps.rs Commits since Resolution Issues License LoC

Release: Build Docs

Master: Build Docs

Adds an unchecked version of unwrap() and expect() to Option and Result for the rust programming language. Supports no_std.

Branches

  • release - For releases only.
  • master - For active development, PR's and testing.

Usage

use unchecked_unwrap::*;

let x = Some("air");
assert_eq!(unsafe { x.unchecked_unwrap() }, "air");

let x: Result<u32, &str> = Ok(2);
assert_eq!(unsafe { x.unchecked_unwrap() }, 2);

let x = Some("value");
assert_eq!(unsafe { x.unchecked_expect("the world is ending") }, "value");

let x: Result<u32, &str> = Ok(2);
assert_eq!(unsafe { x.unchecked_expect("the sky is falling down") }, 2);

Crate features

debug_checks: On by default. Enables the normal checking behavior with panics when debug-assertions is enabled.

Documentation

Documentation is available online in the badge links above. Currently, nightly is needed for full documentation: cargo doc --features doc_include If you are not using nightly, use cargo doc as usual.

Tests

Is as simple as cargo test and cargo test --release.

Benchmarking

Is as simple as cargo bench. Currently the nightly version of rust is needed for benchmarking.

CI

This crate is checked daily by CI to make sure that it builds successfully with the newest versions of rust stable, beta and nightly.

Alternatives

License

This work is dual-licensed under MIT and Apache 2.0. You can choose between one of them if you use this work.

See the LICENSE file for details

SPDX-License-Identifier: MIT OR Apache-2.0

Traits

UncheckedExpect

Trait for unchecked_expect.

UncheckedUnwrap

Trait for unchecked_unwrap.