pub struct Word(_);
Expand description
A candidate or mystery word in a Wordle game
Implementations
sourceimpl Word
impl Word
sourcepub fn char(&self, index: usize) -> char
pub fn char(&self, index: usize) -> char
Returns the the character at the given index
in the word.
sourcepub fn chars(&self) -> impl Iterator<Item = char> + '_
pub fn chars(&self) -> impl Iterator<Item = char> + '_
Returns an iterator over the characters in the word.
sourcepub fn match_code(&self, w: &Word) -> String
pub fn match_code(&self, w: &Word) -> String
Returns a string representing the color code that Wordle would present
for a target word w
.
Examples
let w1 = Word::from("crate");
let w2 = Word::from("space");
assert_eq!(w1.match_code(&w2), "Y_G_G");
assert_eq!(w2.match_code(&w1), "__GYG");
sourcepub fn filter_potential(&self, wordlist: &Wordlist) -> usize
pub fn filter_potential(&self, wordlist: &Wordlist) -> usize
Computes the number of different color codes that are assigned to the Word
when matched against every other word in the wordlist.
Trait Implementations
sourceimpl FromIterator<Word> for Wordlist
impl FromIterator<Word> for Wordlist
sourcefn from_iter<I: IntoIterator<Item = Word>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Word>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl Ord for Word
impl Ord for Word
sourceimpl PartialOrd<Word> for Word
impl PartialOrd<Word> for Word
sourcefn partial_cmp(&self, other: &Word) -> Option<Ordering>
fn partial_cmp(&self, other: &Word) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Word
impl StructuralEq for Word
impl StructuralPartialEq for Word
Auto Trait Implementations
impl RefUnwindSafe for Word
impl Send for Word
impl Sync for Word
impl Unpin for Word
impl UnwindSafe for Word
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more