[][src]Crate unwrap_all

Unpack multiple levels of Result<T, E> and Option<T> at once

use unwrap_all::unwrap_all;

let nested: Option<Result<Option<Result<usize, ()>>, ()>> = Some(Ok(Some(Ok(42))));
let unpacked = unwrap_all!(4, nested);
assert_eq!(42, unpacked);

This crate should work with no_std too.



Running this function will give you a panic with the message 1 - must fail: 23, where the 1 tells you how many levels in the panic was caused.


Use it like this: unwrap_all!(n_times, object)