Struct scout::Scout [] [src]

pub struct Scout<'a> { /* fields omitted */ }

This struct does the fuzzy search over a list of strings

You create a struct instance with all the list items and then you use that instance to filter the list with different queries (list of chars).

Example

use scout::Scout;

let list = vec!["d/e/f.rs", "a/a/b/c.rs", "a/b/c.rs"];
let scout = Scout::new(list);

let query = ['a', 'b', 'c'];
let choices = scout.explore(&query);

let expected = vec!["a/b/c.rs", "a/a/b/c.rs"];
let actual: Vec<String> = choices.into_iter().map(|choice| choice.to_string()).collect();

assert_eq!(expected, actual);

Methods

impl<'a> Scout<'a>
[src]

[src]

Create a new Scout instance with a list of strings

[src]

Search for the choices that match a query, sorted by best match first.

If the query is empty, it returns all the choices with the original order of the items.