Module textwrap::word_separators[][src]

Expand description

Functionality for finding words.

In order to wrap text, we need to know where the legal break points are, i.e., where the words of the text are. This means that we need to define what a “word” is.

A simple approach is to simply split the text on whitespace, but this does not work for East-Asian languages such as Chinese or Japanese where there are no spaces between words. Breaking a long sequence of emojis is another example where line breaks might be wanted even if there are no whitespace to be found.

The WordSeparator trait is responsible for determining where there words are in a line of text. Please refer to the trait and the structs which implement it for more information.

Structs

AsciiSpace

Find words by splitting on regions of ' ' characters.

UnicodeBreakProperties

Find words using the Unicode line breaking algorithm.

Traits

WordSeparator

Describes where words occur in a line of text.