Function betabear::search_for_words [] [src]

pub fn search_for_words<'l, 'dict, D>(
    letters: &'l str,
    dictionary: D
) -> Vec<(&'dict str, usize)> where
    D: Iterator<Item = &'dict str>, 

Filter dictionary by words that can be written with the given letters

Returns a vector of valid words.

let letters = "applepie";
let dictionary = vec!["apple", "pie", "beer"];

let solution = betabear::search_for_words(&letters, dictionary.into_iter());

assert_eq!(solution, vec![("apple", 5), ("pie", 3)]);