Make word list public; addresses #19
This commit is contained in:
parent
520e15a6e5
commit
f01e0b2de4
|
@ -82,7 +82,7 @@ impl Language {
|
||||||
|
|
||||||
/// The word list for this language.
|
/// The word list for this language.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn word_list(self) -> &'static [&'static str; 2048] {
|
pub fn word_list(self) -> &'static [&'static str; 2048] {
|
||||||
match self {
|
match self {
|
||||||
Language::English => &english::WORDS,
|
Language::English => &english::WORDS,
|
||||||
#[cfg(feature = "chinese-simplified")]
|
#[cfg(feature = "chinese-simplified")]
|
||||||
|
@ -146,7 +146,7 @@ impl Language {
|
||||||
|
|
||||||
/// Get the index of the word in the word list.
|
/// Get the index of the word in the word list.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn find_word(self, word: &str) -> Option<u16> {
|
pub fn find_word(self, word: &str) -> Option<u16> {
|
||||||
self.word_list().iter().position(|w| *w == word).map(|i| i as u16)
|
self.word_list().iter().position(|w| *w == word).map(|i| i as u16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue