Skip to main content

find

Function find 

Source
pub fn find(pattern: &str, data: &[String]) -> Vec<Match>
Expand description

Find looks up pattern in data and returns matches in descending order of match quality. Match quality is determined by a set of bonus and penalty rules.

The following types of matches apply a bonus:

  • The first character in the pattern matches the first character in the match string.
  • The matched character is camel cased.
  • The matched character follows a separator such as an underscore character.
  • The matched character is adjacent to a previous match.

Penalties are applied for every character in the search string that wasn’t matched and all leading characters up to the first match.

Results are sorted by best match.