[−][src]Struct wordfeud_solver::Wordlist
A trie data structure that holds all the possible words.
Fields
nodes: Vec<(u32, LabelSet)>
List of nodes in trie. Each node is a tuple with the index of the first
child node, and a CharSet
with the labels of all child nodes.
labels: Vec<u8>
List of labels.
terminal: Vec<bool>
List indicating terminal nodes
wordfile: String
Path of the wordfile used to build the wordlist. Empty if the wordlist is not build from a file.
all_labels: LabelSet
The set of all characters used in the wordlist.
word_count: usize
The number of words in the wordlist
node_count: usize
The number of nodes in the wordlist.
codec: Codec
Encode words to/from labelvec
Implementations
impl Wordlist
[src]
pub fn matches<'a>(
&'a self,
node: usize,
row: Row,
rowdata: &'a RowData,
pos: usize,
letters: &Letters
) -> Matches<'_>
[src]
&'a self,
node: usize,
row: Row,
rowdata: &'a RowData,
pos: usize,
letters: &Letters
) -> Matches<'_>
Return a list of matching words. TODO.
pub fn words<'a>(
&'a self,
row: &'a Row,
rowdata: &'a RowData,
letters: &'a Letters,
maxdist: Option<usize>
) -> impl Iterator<Item = (usize, Word)> + 'a
[src]
&'a self,
row: &'a Row,
rowdata: &'a RowData,
letters: &'a Letters,
maxdist: Option<usize>
) -> impl Iterator<Item = (usize, Word)> + 'a
pub fn get_legal_characters(&self, word: &Row) -> LabelSet
[src]
Return a set of characters that go in the first empty position in word
impl Wordlist
[src]
pub fn from_file(wordfile: &str, codec: &Codec) -> Result<Wordlist, Error>
[src]
Read the wordlist from a file. The file must be encoded in utf-8 and have one word per line.
Errors
Fails if the wordlist can not be read, or a word can not be encoded.
pub fn from_words(words: &[&str], codec: &Codec) -> Result<Wordlist, Error>
[src]
pub fn encode<T: Item>(&self, word: &str) -> Result<ItemList<T>, Error>
[src]
pub fn decode<T: Item>(&self, items: ItemList<T>) -> String
[src]
Decode labels
with our codec
, and return the result as String
.
Errors
If the labels can not be decoded.
pub fn range_children(&self, i: usize) -> Option<(usize, usize)>
[src]
Return the start and end index of the child nodes of node i
,
or None if node is empty.
pub fn iter_children(&self, i: usize) -> IteratorChildren<'_>
[src]
Iterate over the children of node i
.
pub fn get(&self, i: usize, label: u8) -> Option<usize>
[src]
Get the index of child with label
for node i
if present.
pub fn is_word<K: AsRef<[u8]>>(&self, word: K) -> bool
[src]
Returns true if word
is in wordlist
pub fn connected_row(&self, row: &Row) -> RowData
[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Wordlist
[src]
impl Send for Wordlist
[src]
impl Sync for Wordlist
[src]
impl Unpin for Wordlist
[src]
impl UnwindSafe for Wordlist
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,