pub struct WordList { /* private fields */ }Expand description
A list of words, with optional additional metadata.
Implementations§
Source§impl WordList
impl WordList
Sourcepub fn load(
path: impl AsRef<Path>,
metadata_path: impl AsRef<Path>,
) -> Result<WordList, WordListError>
pub fn load( path: impl AsRef<Path>, metadata_path: impl AsRef<Path>, ) -> Result<WordList, WordListError>
Load a word list from a file.
The file is expected to contain one word per line. The word list may also be accompanied by a metadata TOML file. A fully specified metadata file may look like this:
name = "diffenator_latin"
script = "Latn"Sourcepub fn load_without_metadata(
path: impl AsRef<Path>,
) -> Result<WordList, WordListError>
pub fn load_without_metadata( path: impl AsRef<Path>, ) -> Result<WordList, WordListError>
Load a word list from a file.
The file is expected to contain one word per line.
Always prefer WordList::load if metadata is available.
Sourcepub fn define(
name: impl Into<String>,
words: impl IntoIterator<Item = impl Into<String>>,
) -> WordList
pub fn define( name: impl Into<String>, words: impl IntoIterator<Item = impl Into<String>>, ) -> WordList
Create a new word list from an iterable.
Metadata is unspecified.
Sourcepub fn script(&self) -> Option<&str>
pub fn script(&self) -> Option<&str>
Get the script of the word list, if known.
The script is expected to be a ISO 15924 four-letter capitalised code, but this is only guaranteed for built-in word lists.
Sourcepub fn language(&self) -> Option<&str>
pub fn language(&self) -> Option<&str>
Get the language of the word list, if known.
The language is expected to be a ISO 639-1 two-letter code, but this is only guaranteed for built-in word lists.
Sourcepub fn iter(&self) -> WordListIter<'_>
pub fn iter(&self) -> WordListIter<'_>
Iterate through the word list.
Trait Implementations§
Source§impl<'a> IntoParallelIterator for &'a WordList
impl<'a> IntoParallelIterator for &'a WordList
Source§type Iter = ParWordListIter<'a>
type Iter = ParWordListIter<'a>
Source§fn into_par_iter(self) -> <&'a WordList as IntoParallelIterator>::Iter
fn into_par_iter(self) -> <&'a WordList as IntoParallelIterator>::Iter
self into a parallel iterator. Read moreAuto Trait Implementations§
impl !Freeze for WordList
impl RefUnwindSafe for WordList
impl Send for WordList
impl Sync for WordList
impl Unpin for WordList
impl UnsafeUnpin for WordList
impl UnwindSafe for WordList
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
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>
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>
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 moreSource§impl<'data, I> IntoParallelRefIterator<'data> for I
impl<'data, I> IntoParallelRefIterator<'data> for I
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.