skim/engine/
util.rs

1use regex::Regex;
2
3pub fn regex_match(choice: &str, pattern: &Option<Regex>) -> Option<(usize, usize)> {
4    match *pattern {
5        Some(ref pat) => {
6            let mat = pat.find(choice)?;
7            Some((mat.start(), mat.end()))
8        }
9        None => None,
10    }
11}
12
13pub fn contains_upper(string: &str) -> bool {
14    for ch in string.chars() {
15        if ch.is_ascii_uppercase() {
16            return true;
17        }
18    }
19    false
20}