[][src]Module kl_hyphenate::load

Reading and loading hyphenation dictionaries

To hyphenate words in a given language, it is first necessary to load the relevant hyphenation dictionary into memory. This module offers convenience methods for common retrieval patterns, courtesy of the Load trait.

use kl_hyphenate::Load;
use kl_hyphenate::{Standard, Language};

The primary function of Load is to deserialize dictionaries from buffers – usually, file buffers.

use std::io;
use std::fs::File;

let path_to_dict = "/path/to/english-dictionary.bincode";
let dict_file = File::open(path_to_dict) ?;
let mut reader = io::BufReader::new(dict_file);
let english_us = Standard::from_reader(Language::EnglishUS, &mut reader) ?;

Dictionaries can be loaded from the file system rather more succintly with the from_path shorthand:

let path = "dictionaries/en-us.standard.bincode";
let en_us = Standard::from_path(Language::EnglishUS, path) ?;

Enums

Error

Failure modes of dictionary loading.

Traits

Load

Convenience methods for the retrieval of hyphenation dictionaries.

Type Definitions

Result