pub struct Word(/* private fields */);Expand description
A candidate or mystery word in a Wordle game
Implementations§
Source§impl 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§
Source§impl FromIterator<Word> for Wordlist
impl FromIterator<Word> for Wordlist
Source§impl Ord for Word
impl Ord for Word
Source§impl PartialOrd for Word
impl PartialOrd for Word
impl Eq for Word
impl StructuralPartialEq for Word
Auto Trait Implementations§
impl Freeze for Word
impl RefUnwindSafe for Word
impl Send for Word
impl Sync for Word
impl Unpin for Word
impl UnwindSafe for Word
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more