pub trait OptionExt<T> {
    fn contains<U>(&self, x: &U) -> bool
    where
        U: PartialEq<T>
; }
Expand description

Extension trait providing additional methods for Option.

Required methods

Returns true if the option is a Some value containing the given value.

Examples
use option_ext::OptionExt;

let x: Option<u32> = Some(2);
assert_eq!(x.contains(&2), true);

let x: Option<u32> = Some(3);
assert_eq!(x.contains(&2), false);

let x: Option<u32> = None;
assert_eq!(x.contains(&2), false);

Implementations on Foreign Types

Implementors