1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! Unicode character properties, and grapheme, word and line segmentation.
//!
//! The crate reads its own compact tables, generated from the Unicode
//! Character Database. It is `no_std`, depends on nothing but `core` and
//! `alloc`, and no lookup or scan allocates or panics, whatever the input.
//!
//! # Properties
//!
//! [`core_props`] and [`rare_props`] return a character's properties, each a
//! single table lookup and a `u32`. [`CoreProps`] holds the ones a text
//! layout reads for every character: the bidi class, the script and its
//! extensions, paired brackets, and the emoji and break-related flags.
//! [`RareProps`] holds the ones read less often: Grapheme_Cluster_Break,
//! East_Asian_Width, Vertical_Orientation and the casing properties.
//! [`line_break`] returns a character's Line_Break.
//!
//! # Segmentation
//!
//! Each segmenter reads a stream of characters with their offsets, such as
//! [`Utf8Scalars`] or [`Utf16Scalars`], and yields the offsets of the
//! boundaries inside it.
//!
//! - [`Graphemes`] finds extended grapheme clusters (UAX #29).
//! [`GraphemeState`] is its state machine, for a scan that holds the
//! characters already.
//! - [`LineBreaks`] finds line break opportunities (UAX #14), under the CSS
//! tailorings [`LineOptions`] selects.
//! - [`WordBreaks`] finds word boundaries (UAX #29), with the options of
//! [`WordOptions`].
//!
//! Thai, Lao, Khmer and Myanmar have no rules for breaks between words, and
//! Chinese and Japanese words follow no rule either. Inside a run of one of
//! them the line and word segmenters break at the words of a [`Dictionary`],
//! the longest at each position. [`Dictionaries`] holds one per script,
//! compiled in with the `dictionaries` feature or loaded at run time.
//!
//! ```
//! use cleft::{LineBreaks, LineOptions, Utf8Scalars, WordBreaks, WordOptions};
//!
//! let text = "Can't stop, 3.14!";
//! let lines: Vec<usize> = LineBreaks::new(Utf8Scalars::new(text), LineOptions::new()).collect();
//! assert_eq!(lines, [6, 12]);
//! let words: Vec<usize> = WordBreaks::new(Utf8Scalars::new(text), WordOptions::new()).collect();
//! assert_eq!(words, [5, 6, 10, 11, 12, 16]);
//! ```
//!
//! The data and rules are of the Unicode version [`UNICODE_VERSION`] names.
//!
//! # Features
//!
//! No feature is on by default.
//!
//! - `css`: the classes CSS defines and Unicode does not, read from the rare
//! properties: `EastAsianSpacing` for `text-autospace`,
//! `TextSpacingClass` for `text-spacing-trim`, `EmphasisClass` for
//! `text-emphasis-skip` and `FirstLetterClass` for `::first-letter`.
//! Without it a smaller table is compiled, still read by one lookup.
//! - `case`: full case mapping, `uppercase`, `lowercase` and `titlecase`,
//! with the language tailorings of `CaseLanguage` (about 5 KB of tables).
//! - `dictionaries`: the word dictionaries of Thai, Lao, Khmer, Myanmar, and
//! Chinese and Japanese, generated from ICU's word lists and compiled in
//! (about 2.7 MB): `Dictionaries::with_compiled`.
//!
//! # License
//!
//! The crate is licensed under MIT or Apache-2.0. Its tables are generated
//! from the Unicode Character Database, under the Unicode License v3
//! (`LICENSE-UNICODE`). Its dictionaries are generated from ICU's word
//! lists, whose notices are in `THIRD-PARTY`.
extern crate alloc;
extern crate std;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// The examples of the README, run as doc tests.
;