Skip to main content

Module segment

Module segment 

Source

Constants§

WK_PUNCT
word_kind: anything else (punctuation, symbols)
WK_SPACE
word_kind: white space only
WK_WORD
word_kind: a word (a letter or number in it)

Functions§

char_props
the packed properties of a character (see segment_data.rs)
cluster_end
the end of the grapheme cluster that starts at i, a cluster boundary (grapheme_next without looking back: walks from boundary to boundary)
grapheme_next
the end of the grapheme cluster that starts at or holds i (s.len() at the end)
grapheme_prev
the start of the grapheme cluster before i (0 at the start)
graphemes
every cluster boundary of s (0 and s.len() included)
is_grapheme_boundary
i is a cluster boundary
line_breaks
the break opportunities of s: (index where a line may start, mandatory); the end of the text is the last entry (mandatory)
pictographic_cluster
the cluster a..b is an emoji sequence (pictographs, flags, keycaps, ZWJ sequences)
unicode_version
the Unicode version of the tables
word_at
the word segment that holds i (at the end of the text: the last one)
word_bounds
every word boundary of s (0 and s.len() included)
word_kind
the kind of the segment a..b (WK_WORD, WK_SPACE, WK_PUNCT)
word_next
Ctrl+Right: the start of the next word after i (the rest of this word and the spaces after it skipped)
word_prev
Ctrl+Left: the start of the word before i (spaces before i skipped)
wrap_end
where a line starting at pos ends inside pos..pe (pos < end <= pe; pe when pos == pe): the whole rest when it fits, else the last break opportunity whose text before it (without trailing spaces) fits, else grapheme clusters while they fit (at least one); a mandatory break inside ends the line there. fits(a, b): the text a..b fits.
wrap_end_hyph
wrap_end with hyphenation: where a line starting at pos ends inside pos..pe, and whether it ends with a hyphen (to be drawn after its text). As wrap_end, and: an opportunity after a soft hyphen (U+00AD) counts with the hyphen’s width; when the next word does not fit, hyph(word, &mut offsets) gives the places where that whole word (UAX #29) may break (byte offsets inside it, ascending) and the line ends at the last one that fits with a hyphen – also inside a single word too long for a line, before graphemes are cut. Words with a digit or a soft hyphen of their own are never hyphenated. fits(a, b, hyphen): the text a..b fits (with a hyphen after it).