[−][src]Crate unicode_linebreak
Implementation of the Line Breaking Algorithm described in Unicode Standard Annex #14.
Given an input text, locates "line break opportunities", or positions appropriate for wrapping lines when displaying text.
Example
use unicode_linebreak::{linebreaks, BreakOpportunity::{Mandatory, Allowed}}; let text = "a b \nc"; assert!(linebreaks(text).eq(vec![ (2, Allowed), // May break after first space (5, Mandatory), // Must break after line feed (6, Mandatory) // Must break at end of text, so that there always is at least one LB ]));
Enums
BreakClass | Unicode line breaking class. |
BreakOpportunity | Break opportunity type. |
Constants
UNICODE_VERSION | The Unicode version conformed to. |
Functions
break_property | Returns the line break property of the specified code point. |
linebreaks | Returns an iterator over line break opportunities in the specified string. |
split_at_safe | Divides the string at the last index where further breaks do not depend on prior context. |