Function fragment::matching::find [] [src]

pub fn find<T: ToString + Clone>(
    needle: &str,
    haystack: &Vec<T>,
    max_results: usize,
    case_sensitive: bool
) -> Vec<Result<T>>

Given a set, find compares its elements and returns a set of Result objects ordered by increasing score values (first values are closest matches). If the result set is larger than max_results, the set is reduced to that size.

Examples

use fragment::matching::find;

let entries = vec![
    "fragment.rs".to_string(),
    "lib.rs".to_string()
];
let matches = find("lib", &entries, 1, true);

assert_eq!(*matches[0], "lib.rs");