Debian Codegraph @

src/grapheme_clusters.rs

raw symbols SCIP
1 //! This module provides two interfaces for accessing clusters from an underlying string. The
2 //! `GraphemeCluster` trait extends the `Peekable` iterators over `Chars` or `CharIndices`
3 //! to add a `next_cluster` method which returns `Option<String>` with the next
4 //! cluster if one exists. This is the best method for getting individual clusters from a stream which is normally
5 //! only getting `char`s but is not recommended if you wish to iterate over clusters.
6 //! ```
7 //! # use crate::finl_unicode::grapheme_clusters::GraphemeCluster;
8 //! let mut char_iterator = "A\u{301}✋🏽🇦🇹!".chars().peekable();
9 //! assert_eq!(char_iterator.next_cluster(), Some("A\u{301}".to_string()));
10 //! assert_eq!(char_iterator.next_cluster(), Some("✋🏽".to_string()));
11 //! assert_eq!(char_iterator.next_cluster(), Some("🇦🇹".to_string()));
12 //! assert_eq!(char_iterator.next_cluster(), Some("!".to_string()));
13 //! assert_eq!(char_iterator.next_cluster(), None);
14 //! ```
15 //!
16 //! For the iterating over clusters case there is a struct `Graphemes` which implements `iterator`
17 //! and can be constructed from a `&str`. This returns references to substrings of the original
18 //! `&str` and is more performant for that case than the extended iterator provided through
19 //! `GraphemeCluster` which allocates a new `String` for each cluster found.
20 //! ```
21 //! # use crate::finl_unicode::grapheme_clusters::Graphemes;
22 //! let graphemes = Graphemes::new("A\u{301}✋🏽🇦🇹!");
23 //! assert_eq!(graphemes.collect::<Vec<&str>>(), ["A\u{301}", "✋🏽", "🇦🇹", "!"])
24 //! ```
25
26 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::Peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/Peekable#;
27 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::CharIndicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/CharIndices#;
28 use craterust-analyzer cargo finl_unicode 1.4.0 crate/::datarust-analyzer cargo finl_unicode 1.4.0 data/::grapheme_propertyrust-analyzer cargo finl_unicode 1.4.0 data/grapheme_property/::{GP_PAGES,GP_TABLE};
29
30
31 /// `Graphemes` provides an iterator over the grapheme clusters of a string.
32 pub struct Graphemesrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#<'a> {
33 inputrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#input.: &'a str,
34 iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter.: Peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/Peekable#<CharIndicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/CharIndices#<'a>>,
35 }
36
37 impl<'a> Graphemesrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#<'a> {
38 /// A new instance of graphemes can be constructed from a string using `Graphemes::new`
39 /// ```
40 /// # use crate::finl_unicode::grapheme_clusters::Graphemes;
41 /// let graphemes = Graphemes::new("some string");
42 /// ```
43 pub fn newrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Graphemes<'a>`]new().(input: &'a str) -> Graphemesrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#<'a> {
44 let iter = input.char_indicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]char_indices().().peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().();
45 Graphemesrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes# {
46 inputrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#input.,
47 iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter.
48 }
49 }
50 }
51
52 impl<'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Graphemesrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#<'a> {
53 type Itemrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Graphemes<'a>`][Iterator]Item# = &'a str;
54 #[inline]
55 /// Return a slice of the underlying
56 /// string corresponding to the next cluster if one exists, or `None` if the end of the string
57 /// has been reached.
58 fn nextrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Graphemes<'a>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Graphemes<'a>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
59 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&(start, _)) = self.iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().() {
60 let mut cluster_machine = ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#::newrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]new().();
61 loop {
62 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&(curr_loc, ch)) = self.iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().() {
63 match cluster_machine.find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().(ch) {
64 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None# => { self.iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().(); }
65 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before# => {
66 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&self.inputrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#input.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#curr_loc]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
67 }
68 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Afterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#After# => {
69 self.iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().();
70 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(
71 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&(curr_loc, _)) = self.iterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#iter..peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().() {
72 &self.inputrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#input.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#curr_loc]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
73 } else {
74 &self.inputrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#input.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
75 });
76 }
77 }
78 }
79 else {
80 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&self.inputrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#input.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
81 }
82 }
83 } else {
84 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
85 }
86 }
87 }
88
89 /// Get the next grapheme cluster from a stream of characters or char indices
90 /// This trait is implemented for any `Peekable` iterator over either `char` or `(usize, char)` (so
91 /// it will work on `Peekable<Chars>` and `Peekable<CharIndices>` as well as any other peekable iterator
92 /// which meets this requirement.
93 pub trait GraphemeClusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeCluster#<T> {
94 fn next_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeCluster#next_cluster().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>;
95 }
96
97 impl<T> GraphemeClusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeCluster#<T> for T where T: PeekCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar# {
98 /// Returns the next cluster if there is one in an `Option<String>`. Since this has a heap allocation
99 /// it is *not* recommended for iterating over all the clusters in a string. In that case, use
100 /// `Graphemes` instead.
101 #[inline]
102 fn next_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[T][`GraphemeCluster<Self>`]next_cluster().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
103 if self.has_nextrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar#has_next().() {
104 let mut cluster_machine = ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#::newrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]new().();
105 let mut rv = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
106 loop {
107 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ch) = self.peek_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar#peek_char().() {
108 let state = cluster_machine.find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().(ch);
109 match state {
110 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None# => {
111 rv.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(ch);
112 self.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().();
113 }
114 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before# => { return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(rv); }
115 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Afterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#After# => {
116 rv.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(ch);
117 self.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().();
118 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(rv);
119 }
120 }
121 } else {
122 break;
123 }
124 }
125 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(rv)
126 } else {
127 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
128 }
129 }
130
131 }
132
133 /// This trait exists primarily to allow a single implementation to be used for both `Peekable<Chars>`
134 /// and `Peekable<CharIndices>`. You could implement this for some other iterator if you like as
135 /// long as you can implement the two methods below.
136 pub trait PeekCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar#: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# {
137 /// Returns the next character (if it exists) or `None` otherwise.
138 fn peek_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar#peek_char().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char>;
139 /// Returns `true` if there is another character available on the iterator, `false` otherwise.
140 fn has_nextrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar#has_next().(&mut self) -> bool;
141 }
142
143 trait HasCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/HasChar# {
144 fn get_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/HasChar#get_char().(& self) -> char;
145 }
146
147 impl HasCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/HasChar# for char {
148 fn get_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[char][HasChar]get_char().(& self) -> char {
149 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self
150 }
151 }
152
153 impl HasCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/HasChar# for (usize, char) {
154 fn get_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`(usize, char)`][HasChar]get_char().(&self) -> char {
155 self.1
156 }
157 }
158
159 impl<CharIter, C: HasCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/HasChar#> PeekCharrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/PeekChar# for Peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/Peekable#<CharIter>
160 where CharIter: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = C>
161 {
162 #[inline]
163 fn peek_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Peekable<CharIter>`][PeekChar]peek_char().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char> {
164 self.peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|c| c.get_charrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/HasChar#get_char().())
165 }
166
167 #[inline]
168 fn has_nextrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Peekable<CharIter>`][PeekChar]has_next().(&mut self) -> bool {
169 self.peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
170 }
171 }
172
173 // ------------------------
174 // Private implementation details follow
175
176 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
177 enum ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState# {
178 Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start#,
179 Precorerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Precore#,
180 CcsBaserust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsBase#,
181 CrLfrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CrLf#,
182 HangulSyllableLrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableL#,
183 HangulSyllableVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableV#,
184 HangulSyllableTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableT#,
185 CcsExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsExtend#,
186 Flagrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Flag#,
187 Emojirust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Emoji#,
188 EmojiZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#EmojiZWJ#,
189 IndicClusterStartrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterStart#,
190 IndicClusterExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterExtend#,
191 Otherrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Other#,
192 }
193
194 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
195 enum Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break# {
196 Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#,
197 Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#,
198 Afterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#After#,
199 }
200
201 struct ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine# {
202 staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state.: ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#,
203 }
204
205 impl ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine# {
206 #[inline]
207 pub fn newrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]new().() -> ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine# {
208 ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine# {
209 staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state.: ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start#,
210 }
211 }
212
213 /// If we have a cluster, we return the cluster in a `String` in an `Option` long with a `bool`
214 /// If the `bool` is true, it means that we are also consuming the character in the cluster.
215 #[inline]
216 pub fn find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().(&mut self, c: char) -> Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break# {
217 if self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. rust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachineState][`PartialEq<Self>`]eq().==rust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachineState][`PartialEq<Self>`]eq(). rust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachineState][`PartialEq<Self>`]eq().ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start# {
218 return self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
219 }
220 let property = get_propertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/get_property().(c);
221
222 if property rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::CONTROLrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]CONTROL. {
223 return if self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. rust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachineState][`PartialEq<Self>`]eq().==rust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachineState][`PartialEq<Self>`]eq(). rust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachineState][`PartialEq<Self>`]eq().ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CrLfrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CrLf# && c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\n' {
224 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start#;
225 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Afterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#After#
226 } else {
227 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\r' {
228 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CrLfrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CrLf#;
229 } else {
230 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start#;
231 }
232 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
233 }
234 }
235
236 match self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. {
237 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start# => self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c),
238 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Precorerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Precore# => {
239 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
240 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
241 }
242 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableLrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableL# => {
243 match property {
244 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Lrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]L. => Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#,
245 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Vrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]V. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::LVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]LV. => {
246 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableV#;
247 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
248 }
249 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::LVTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]LVT. => {
250 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableT#;
251 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
252 }
253 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => {
254 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsBaserust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsBase#;
255 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
256 }
257 _ => {
258 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
259 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
260 }
261 }
262 }
263 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableV# => {
264 match property {
265 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Vrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]V. => Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#,
266 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Trust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]T. => {
267 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableT#;
268 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
269 }
270 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => {
271 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsBaserust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsBase#;
272 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
273 }
274 _ => {
275 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
276 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
277 }
278 }
279 }
280 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableT# => {
281 match property {
282 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Trust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]T. => Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#,
283 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => {
284 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsBaserust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsBase#;
285 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
286 }
287 _ => {
288 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
289 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
290 }
291 }
292 }
293 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsExtend# => {
294 match property {
295 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND.
296 | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK.
297 | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER.
298 | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#,
299 _ => Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
300 }
301 }
302 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Flagrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Flag# => {
303 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start#;
304 match property {
305 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::REGIONAL_INDICATORrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]REGIONAL_INDICATOR. => {
306 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Otherrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Other#;
307 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
308 }
309 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND.
310 | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK.
311 | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER.
312 | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => {
313 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsExtend#;
314 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
315 }
316 _ => {
317 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
318 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
319 }
320 }
321 }
322 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Emojirust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Emoji# => {
323 match property {
324 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => {
325 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::EmojiZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#EmojiZWJ#;
326 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
327 }
328 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. => {
329 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Emojirust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Emoji#;
330 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
331 }
332 _ => {
333 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
334 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
335 }
336 }
337 }
338 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::EmojiZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#EmojiZWJ# => {
339 if property rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDED_GRAPHEMErust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTENDED_GRAPHEME. {
340 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Emojirust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Emoji#;
341 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
342 } else {
343 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
344 }
345 }
346 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CrLfrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CrLf# => Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#,
347 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::IndicClusterStartrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterStart# => {
348 match property {
349 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. => {
350 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::IndicClusterExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterExtend#;
351 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
352 }
353 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK.=> {
354 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
355 }
356 _ => {
357 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
358 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
359 }
360 }
361 }
362 ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::IndicClusterExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterExtend# => {
363 match property {
364 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ. => {
365 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
366 }
367 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_CONSONANTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_CONSONANT. => {
368 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::IndicClusterStartrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterStart#;
369 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
370 }
371 _ => {
372 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
373 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
374 }
375 }
376 }
377 _ => {
378 if is_continuationrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/is_continuation().(property) {
379 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
380 } else {
381 self.first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(c);
382 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#
383 }
384 }
385 }
386 }
387 #[inline]
388 fn first_characterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]first_character().(&mut self, c: char) -> Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break# {
389 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\r' {
390 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CrLfrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CrLf#;
391 return Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#;
392 }
393 let property = get_propertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/get_property().(c);
394 if property rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::CONTROLrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]CONTROL. {
395 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Startrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Start#;
396 return Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Afterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#After#;
397 }
398 match property {
399 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::PREPENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]PREPEND. => {
400 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Precorerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Precore#;
401 }
402 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND. | GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER. => {
403 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsExtend#;
404 }
405 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK. => {
406 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::CcsExtendrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#CcsExtend#;
407 }
408 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Lrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]L. => {
409 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableLrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableL#;
410 }
411 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Vrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]V. => {
412 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableV#;
413 }
414 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::Trust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]T. => {
415 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableT#;
416 }
417 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::LVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]LV. => {
418 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableV#;
419 }
420 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::LVTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]LVT. => {
421 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::HangulSyllableTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#HangulSyllableT#;
422 }
423 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::EXTENDED_GRAPHEMErust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTENDED_GRAPHEME. => {
424 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Emojirust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Emoji#;
425 }
426 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::REGIONAL_INDICATORrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]REGIONAL_INDICATOR. => {
427 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Flagrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Flag#;
428 }
429 GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty#::IN_CONSONANTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_CONSONANT. => {
430 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::IndicClusterStartrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#IndicClusterStart#;
431 }
432 _ => {
433 self.staterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#state. = ClusterMachineStaterust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#::Otherrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachineState#Other#;
434 }
435 }
436 Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#
437 }
438 }
439
440 #[inline]
441 fn is_continuationrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/is_continuation().(property: u8) -> bool {
442 property rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0 && property rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x2c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0
443 }
444
445
446 // Symbolic names for properties in data tables
447 struct GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty# {}
448 impl GraphemePropertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/GraphemeProperty# {
449 const EXTENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTEND.: u8 = 0x01;
450 const SPACING_MARKrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]SPACING_MARK.: u8 = 0x02;
451 const ZWJrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]ZWJ.: u8 = 0x03;
452 const CONTROLrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]CONTROL.: u8 = 0x04;
453 const PREPENDrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]PREPEND.: u8 = 0x05;
454 const EXTENDED_GRAPHEMErust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]EXTENDED_GRAPHEME.: u8 = 0x06;
455 const REGIONAL_INDICATORrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]REGIONAL_INDICATOR.: u8 = 0x07;
456 const Lrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]L.: u8 = 0x0c;
457 const Vrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]V.: u8 = 0x08;
458 const Trust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]T.: u8 = 0x09;
459 const LVrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]LV.: u8 = 0x0d;
460 const LVTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]LVT.: u8 = 0x0e;
461 const IN_CONSONANTrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_CONSONANT.: u8 = 0x20;
462 const IN_LINKERrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[GraphemeProperty]IN_LINKER.: u8 = 0x11;
463 }
464
465
466 #[inline]
467 fn get_propertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/get_property().(c: char) -> u8 {
468 GP_PAGES[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#from().(GP_TABLE[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().(c as usize) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().(c as usize) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().0xff]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
469 }
470
471
472
473 #[cfg(test)]
474 pub (craterust-analyzer cargo finl_unicode 1.4.0 crate/) mod testsrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/tests/ {
475 use craterust-analyzer cargo finl_unicode 1.4.0 crate/::grapheme_clustersrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/::*;
476
477 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
478 fn low_level_interface_testrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/tests/low_level_interface_test().() {
479 let mut machine = ClusterMachinerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/ClusterMachine#::newrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]new().();
480 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(machine.find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().('\r'), Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Nonerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#None#);
481 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(machine.find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().('a'), Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#);
482 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(machine.find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().('\r'), Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Beforerust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#Before#);
483 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(machine.find_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[ClusterMachine]find_cluster().('\n'), Breakrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#::Afterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Break#After#);
484 }
485
486 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
487 fn can_get_clustersrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/tests/can_get_clusters().() {
488 let mut peekable_index = "\r\ne\u{301}f".char_indicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]char_indices().().peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().();
489 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("\r\n".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), peekable_index.next_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[T][`GraphemeCluster<Self>`]next_cluster().());
490 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("e\u{301}".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), peekable_index.next_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[T][`GraphemeCluster<Self>`]next_cluster().());
491 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("f".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), peekable_index.next_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[T][`GraphemeCluster<Self>`]next_cluster().());
492 }
493
494 pub (craterust-analyzer cargo finl_unicode 1.4.0 crate/) fn grapheme_testrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/tests/grapheme_test().(input: &str, expected_output: &[&str], message: &str) {
495 let mut iter = input.char_indicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]char_indices().().peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().();
496 let mut clusters = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!();
497 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cluster) = iter.next_clusterrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[T][`GraphemeCluster<Self>`]next_cluster().() {
498 clusters.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(cluster);
499 }
500 let codes :Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = input.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(get_propertyrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/get_property().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
501 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(clusters.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), expected_output.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), "Lengths did not match on Grapheme Cluster\n\t{message}\n\tOutput: {clusters:?}\n\tExpected: {expected_output:?}\n\tCodes: {codes:x?}");
502 clusters.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(expected_output.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`&'a [T]`][IntoIterator]into_iter().())
503 .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(actual, &expected)| assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(actual.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), expected, "GraphemeCluster mismatch: {message}"));
504
505 let iter = Graphemesrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/Graphemes#::newrust-analyzer cargo finl_unicode 1.4.0 grapheme_clusters/impl#[`Graphemes<'a>`]new().(input);
506 let clusters = iter.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>>();
507 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(clusters.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), expected_output.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), "Lengths did not match on Grapheme Cluster Indices\n\t{message}\n\tOutput: {clusters:?}\n\tExpected: {expected_output:?}");
508 clusters.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(expected_output.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`&'a [T]`][IntoIterator]into_iter().())
509 .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(actual, &expected)| assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().actual, expected, "Grapheme cluster indices mismatch: {message}\n{} ≠ {}", actual.escape_unicoderust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]escape_unicode().(), expected.escape_unicoderust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]escape_unicode().()));
510 }
511
512 }