pub trait Wordlist {
    // Required method
    fn get_all() -> &'static [&'static str];

    // Provided methods
    fn get(index: usize) -> Result<&'static str, WordlistError> { ... }
    fn get_index(word: &str) -> Result<usize, WordlistError> { ... }
}
Expand description

The Wordlist trait that every language’s wordlist must implement.

Required Methods§

source

fn get_all() -> &'static [&'static str]

Returns the word list as a string.

Implementor’s note: this MUST be sorted

Provided Methods§

source

fn get(index: usize) -> Result<&'static str, WordlistError>

Returns the word of a given index from the word list.

source

fn get_index(word: &str) -> Result<usize, WordlistError>

Returns the index of a given word from the word list.

Implementors§