56
56
) ]
57
57
#![ no_std]
58
58
59
+ #[ cfg( test) ]
60
+ extern crate std;
61
+
59
62
pub use grapheme:: { GraphemeCursor , GraphemeIncomplete } ;
60
63
pub use grapheme:: { GraphemeIndices , Graphemes } ;
61
64
pub use sentence:: { USentenceBoundIndices , USentenceBounds , UnicodeSentences } ;
62
65
pub use tables:: UNICODE_VERSION ;
63
- pub use word:: { UWordBoundIndices , UWordBounds , UnicodeWordIndices , UnicodeWords } ;
66
+ pub use word:: { UWordBoundIndices , UWordBounds } ;
64
67
65
68
mod grapheme;
66
69
mod sentence;
@@ -133,7 +136,7 @@ pub trait UnicodeSegmentation {
133
136
///
134
137
/// assert_eq!(&uw1[..], b);
135
138
/// ```
136
- fn unicode_words ( & self ) -> UnicodeWords < ' _ > ;
139
+ fn unicode_words ( & self ) -> impl Iterator < Item = & ' _ str > ;
137
140
138
141
/// Returns an iterator over the words of `self`, separated on
139
142
/// [UAX#29 word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries), and their
@@ -157,7 +160,7 @@ pub trait UnicodeSegmentation {
157
160
///
158
161
/// assert_eq!(&uwi1[..], b);
159
162
/// ```
160
- fn unicode_word_indices ( & self ) -> UnicodeWordIndices < ' _ > ;
163
+ fn unicode_word_indices ( & self ) -> impl Iterator < Item = ( usize , & ' _ str ) > ;
161
164
162
165
/// Returns an iterator over substrings of `self` separated on
163
166
/// [UAX#29 word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries).
@@ -173,7 +176,7 @@ pub trait UnicodeSegmentation {
173
176
///
174
177
/// assert_eq!(&swu1[..], b);
175
178
/// ```
176
- fn split_word_bounds ( & self ) -> UWordBounds < ' _ > ;
179
+ fn split_word_bounds ( & self ) -> impl DoubleEndedIterator < Item = & ' _ str > ;
177
180
178
181
/// Returns an iterator over substrings of `self`, split on UAX#29 word boundaries,
179
182
/// and their offsets. See `split_word_bounds()` for more information.
@@ -188,7 +191,7 @@ pub trait UnicodeSegmentation {
188
191
///
189
192
/// assert_eq!(&swi1[..], b);
190
193
/// ```
191
- fn split_word_bound_indices ( & self ) -> UWordBoundIndices < ' _ > ;
194
+ fn split_word_bound_indices ( & self ) -> impl DoubleEndedIterator < Item = ( usize , & ' _ str ) > ;
192
195
193
196
/// Returns an iterator over substrings of `self` separated on
194
197
/// [UAX#29 sentence boundaries](http://www.unicode.org/reports/tr29/#Sentence_Boundaries).
@@ -210,7 +213,7 @@ pub trait UnicodeSegmentation {
210
213
///
211
214
/// assert_eq!(&us1[..], b);
212
215
/// ```
213
- fn unicode_sentences ( & self ) -> UnicodeSentences < ' _ > ;
216
+ fn unicode_sentences ( & self ) -> impl Iterator < Item = & ' _ str > ;
214
217
215
218
/// Returns an iterator over substrings of `self` separated on
216
219
/// [UAX#29 sentence boundaries](http://www.unicode.org/reports/tr29/#Sentence_Boundaries).
@@ -258,27 +261,27 @@ impl UnicodeSegmentation for str {
258
261
}
259
262
260
263
#[ inline]
261
- fn unicode_words ( & self ) -> UnicodeWords {
264
+ fn unicode_words ( & self ) -> impl Iterator < Item = & ' _ str > {
262
265
word:: new_unicode_words ( self )
263
266
}
264
267
265
268
#[ inline]
266
- fn unicode_word_indices ( & self ) -> UnicodeWordIndices {
269
+ fn unicode_word_indices ( & self ) -> impl Iterator < Item = ( usize , & ' _ str ) > {
267
270
word:: new_unicode_word_indices ( self )
268
271
}
269
272
270
273
#[ inline]
271
- fn split_word_bounds ( & self ) -> UWordBounds {
274
+ fn split_word_bounds ( & self ) -> impl DoubleEndedIterator < Item = & ' _ str > {
272
275
word:: new_word_bounds ( self )
273
276
}
274
277
275
278
#[ inline]
276
- fn split_word_bound_indices ( & self ) -> UWordBoundIndices {
279
+ fn split_word_bound_indices ( & self ) -> impl DoubleEndedIterator < Item = ( usize , & ' _ str ) > {
277
280
word:: new_word_bound_indices ( self )
278
281
}
279
282
280
283
#[ inline]
281
- fn unicode_sentences ( & self ) -> UnicodeSentences {
284
+ fn unicode_sentences ( & self ) -> impl Iterator < Item = & ' _ str > {
282
285
sentence:: new_unicode_sentences ( self )
283
286
}
284
287
0 commit comments