Merge pull request #20 from Dr-Julius-No/master

Make word list public; addresses #19
This commit is contained in:
Steven Roose 2022-05-13 13:48:52 +01:00 committed by GitHub
commit da090d223a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,7 @@ impl Language {
/// The word list for this language.
#[inline]
pub(crate) fn word_list(self) -> &'static [&'static str; 2048] {
pub fn word_list(self) -> &'static [&'static str; 2048] {
match self {
Language::English => &english::WORDS,
#[cfg(feature = "chinese-simplified")]
@ -146,7 +146,7 @@ impl Language {
/// Get the index of the word in the word list.
#[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)
}
}