1/*!
2Script aware cluster segmentation.
34This module provides support for breaking text into clusters that are
5appropriate for shaping with a given script. For most scripts, clusters are
6equivalent to Unicode grapheme clusters. More complex scripts, however,
7may produce shaping clusters that contain multiple graphemes.
8*/
910mod char;
11#[allow(clippy::module_inception)]
12mod cluster;
13mod complex;
14mod info;
15mod myanmar;
16mod parse;
17mod simple;
18mod token;
1920pub use self::{
21 char::{Char, ShapeClass},
22 cluster::{CharCluster, SourceRange, Status, MAX_CLUSTER_SIZE},
23 info::{CharInfo, ClusterInfo, Emoji, Whitespace},
24 parse::Parser,
25 token::Token,
26};
2728use super::unicode_data;
2930/// Boundary type of a character or cluster.
31#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug)]
32#[repr(u8)]
33pub enum Boundary {
34/// Not a boundary.
35None = 0,
36/// Start of a word.
37Word = 1,
38/// Potential line break.
39Line = 2,
40/// Mandatory line break.
41Mandatory = 3,
42}
4344impl Boundary {
45pub(super) fn from_raw(raw: u16) -> Self {
46match raw & 0b11 {
470 => Self::None,
481 => Self::Word,
492 => Self::Line,
503 => Self::Mandatory,
51_ => Self::None,
52 }
53 }
54}
5556/// Arbitrary user data that can be associated with a character throughout
57/// the shaping pipeline.
58pub type UserData = u32;