Trait libhealth::utils::prelude::OptionU32Ext
source · pub trait OptionU32Ext {
// Required method
fn unwrap_ori(self, _: i64) -> i64;
}
Required Methods§
sourcefn unwrap_ori(self, _: i64) -> i64
fn unwrap_ori(self, _: i64) -> i64
Return the inner value of self
is Some, or alternative
Arguments
self
- The value to check.alternative
- The alternative value to return.
Returns
One of the two values.
Examples
use libhealth::utils::prelude::*;
let val: Option<u32> = Some(5);
let none: Option<u32> = None;
assert_eq!(val.unwrap_ori(-1), 5);
assert_eq!(none.unwrap_ori(-1), -1);