use std::cmp::Ordering;
#[derive(Clone)]
struct WordlistSubset<'a> {
word_len: usize,
pub(crate) words: &'a [WordlistDecodeEntry<'a>],
}
impl<'a> std::fmt::Debug for WordlistSubset<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(
f,
"WordlistSubset {{ word_len: {}, words: &{:?} }}",
self.word_len, self.words
)
}
}
#[derive(Clone, Debug, PartialEq)]
struct WordlistDecodeEntry<'a> {
pub(crate) word: &'a str,
byte: u8,
}
impl<'a> PartialOrd for WordlistDecodeEntry<'a> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match self.word.len().partial_cmp(&other.word.len())? {
Ordering::Equal => self.word.partial_cmp(other.word),
ordering => Some(ordering),
}
}
}