Function close_enough::matches
source · [−]pub fn matches<Candidate, Query>(candidate: Candidate, query: Query) -> boolwhere
Candidate: AsRef<str>,
Query: AsRef<str>,
Expand description
Check if a query matches a given candidate.
This algorithm works by scanning through the candidate trying to match the beginning of the query. Once a match has begun, any non-matching characters will cause the scan to skip to the next word of the candidate. If the end of the option is reached before the entire query has been matched somewhere, the option is considered not to match.
Examples
assert!(close_enough::matches("three-word_candidate", "twordcan"));
assert!(!close_enough::matches("three-word_candidate", "candidates"));