Skip to main content

get_matches

Function get_matches 

Source
pub fn get_matches<T: SSS + Render>(
    items: impl IntoIterator<Item = T>,
    query: &str,
    timeout: Duration,
    f: impl FnMut(&T) -> bool,
)
Expand description

Map f on matches without starting the interface.

Examples found in repository?
examples/noninteractive.rs (lines 12-15)
7pub fn mm_get_match<T: SSS + Clone + Render>(
8    items: impl IntoIterator<Item = T>,
9    query: &str,
10) -> Option<T> {
11    let mut ret = None;
12    get_matches(items, query, Duration::from_millis(10), |x| {
13        ret = Some(x.clone());
14        true
15    });
16    ret
17}