| Crates.io | is_none_or |
| lib.rs | is_none_or |
| version | 0.1.0 |
| created_at | 2023-11-15 18:55:02.106984+00 |
| updated_at | 2023-11-15 18:55:02.106984+00 |
| description | A simple utility function for the Option type |
| homepage | https://github.com/PokeJofeJr4th/is_none_or |
| repository | https://github.com/PokeJofeJr4th/is_none_or |
| max_upload_size | |
| id | 1036690 |
| size | 3,437 |
IsNoneOr traitThe provided is_none_or method is a mirror to the core library's is_some_and method.
It returns true if the option is a [None] or the option is [Some] and the value
inside of it matches a predicate.
use is_none_or::IsNoneOr;
let x: Option<u32> = Some(2);
assert_eq!(x.is_none_or(|x| x > 1), true);
let x: Option<u32> = Some(0);
assert_eq!(x.is_none_or(|x| x > 1), false);
let x: Option<u32> = None;
assert_eq!(x.is_none_or(|x| x > 1), true);