any

Function any 

Source
pub fn any<T>(pattern: impl AsRef<T::Pattern>, val: T) -> bool
where T: MatchOne,
Expand description

Call MatchOne::is_match_one

Match '-' Please write at the beginning or end, e.g "a-z-"

ยงExamples

assert!(any("ab",       'a'));
assert!(any("ab",       'b'));
assert!(any("a-c",      'a'));
assert!(any("a-c",      'b'));
assert!(any("a-ce-f",   'e'));
assert!(any("a-ce-",    '-'));
assert!(any("a-ce-",    'e'));
assert!(any("a-c",      Some('b')));
assert!(any("a-c",      ['b', 'd']));
assert!(any("a-c",      "bd"));

assert!(! any("a-c",    '-'));
assert!(! any("a-ce-",  'f'));

assert!(! any("a-c",    None::<char>));
assert!(! any("a-c",    ['d', 'b']));
assert!(! any("a-c",    "db"));