Macro vipers::unwrap_checked
source · [−]macro_rules! unwrap_checked {
($body:block $(,)?) => { ... };
}
Expand description
Unwraps the result of a block of checked integer math.
Example
let result = unwrap_checked!({
let one: u64 = 1;
let three: u64 = 3;
one.checked_add(three)
});
assert_eq!(result, 4);