Function hypher::hyphenate_bounded

source ·
pub fn hyphenate_bounded(
    word: &str,
    lang: Lang,
    left_min: usize,
    right_min: usize
) -> Syllables<'_> 
Expand description

Segment a word into syllables, but forbid breaking betwen the given number of chars to each side.

Returns an iterator over the syllables.

§Panics

Panics if the word is more than 41 bytes long and the alloc feature is disabled.

§Example

By setting the left bound to three, we forbid the possible break between ex and ten.

let mut syllables = hyphenate_bounded("extensive", Lang::English, 3, 1);
assert_eq!(syllables.next(), Some("exten"));
assert_eq!(syllables.next(), Some("sive"));
assert_eq!(syllables.next(), None);