wpsr 0.3.1

Command line program to help solve word puzzles
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::collections::HashSet;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct WeightedWord {
    pub word: String,
    pub weight: usize,
}

impl WeightedWord {
    pub fn new(word: String, unused_letters: String) -> Self {
        let set: HashSet<char> = word.chars().collect();
        let weight = unused_letters.chars().filter(|c| set.contains(c)).count();
        WeightedWord { word, weight }
    }
}