pub trait OptionExt<T> {
pub fn has<U>(&self, value: &U) -> bool
where
U: PartialEq<T>;
}
Loading content...Returns true
if the option is a Some
value containing the given value.
use fungus::core::*;
let x: Option<u32> = Some(2);
assert!(x.has(&2));
let x: Option<u32> = Some(3);
assert!(!x.has(&2));
let x: Option<u32> = None;
assert!(!x.has(&2));
Loading content...Loading content...