@@ -65,6 +65,8 @@ pub use sentence::{USentenceBoundIndices, USentenceBounds, UnicodeSentences};
65
65
pub use tables:: UNICODE_VERSION ;
66
66
pub use word:: { UWordBoundIndices , UWordBounds } ;
67
67
68
+ use crate :: word:: { UnicodeWordIndices , UnicodeWords } ;
69
+
68
70
mod grapheme;
69
71
mod sentence;
70
72
#[ rustfmt:: skip]
@@ -136,7 +138,7 @@ pub trait UnicodeSegmentation {
136
138
///
137
139
/// assert_eq!(&uw1[..], b);
138
140
/// ```
139
- fn unicode_words ( & self ) -> impl Iterator < Item = & ' _ str > ;
141
+ fn unicode_words ( & self ) -> UnicodeWords ;
140
142
141
143
/// Returns an iterator over the words of `self`, separated on
142
144
/// [UAX#29 word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries), and their
@@ -160,7 +162,7 @@ pub trait UnicodeSegmentation {
160
162
///
161
163
/// assert_eq!(&uwi1[..], b);
162
164
/// ```
163
- fn unicode_word_indices ( & self ) -> impl Iterator < Item = ( usize , & ' _ str ) > ;
165
+ fn unicode_word_indices ( & self ) -> UnicodeWordIndices ;
164
166
165
167
/// Returns an iterator over substrings of `self` separated on
166
168
/// [UAX#29 word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries).
@@ -176,7 +178,7 @@ pub trait UnicodeSegmentation {
176
178
///
177
179
/// assert_eq!(&swu1[..], b);
178
180
/// ```
179
- fn split_word_bounds ( & self ) -> impl DoubleEndedIterator < Item = & ' _ str > ;
181
+ fn split_word_bounds ( & self ) -> UWordBounds ;
180
182
181
183
/// Returns an iterator over substrings of `self`, split on UAX#29 word boundaries,
182
184
/// and their offsets. See `split_word_bounds()` for more information.
@@ -191,7 +193,7 @@ pub trait UnicodeSegmentation {
191
193
///
192
194
/// assert_eq!(&swi1[..], b);
193
195
/// ```
194
- fn split_word_bound_indices ( & self ) -> impl DoubleEndedIterator < Item = ( usize , & ' _ str ) > ;
196
+ fn split_word_bound_indices ( & self ) -> UWordBoundIndices ;
195
197
196
198
/// Returns an iterator over substrings of `self` separated on
197
199
/// [UAX#29 sentence boundaries](http://www.unicode.org/reports/tr29/#Sentence_Boundaries).
@@ -261,22 +263,22 @@ impl UnicodeSegmentation for str {
261
263
}
262
264
263
265
#[ inline]
264
- fn unicode_words ( & self ) -> impl Iterator < Item = & ' _ str > {
266
+ fn unicode_words ( & self ) -> UnicodeWords {
265
267
word:: new_unicode_words ( self )
266
268
}
267
269
268
270
#[ inline]
269
- fn unicode_word_indices ( & self ) -> impl Iterator < Item = ( usize , & ' _ str ) > {
271
+ fn unicode_word_indices ( & self ) -> UnicodeWordIndices {
270
272
word:: new_unicode_word_indices ( self )
271
273
}
272
274
273
275
#[ inline]
274
- fn split_word_bounds ( & self ) -> impl DoubleEndedIterator < Item = & ' _ str > {
276
+ fn split_word_bounds ( & self ) -> UWordBounds {
275
277
word:: new_word_bounds ( self )
276
278
}
277
279
278
280
#[ inline]
279
- fn split_word_bound_indices ( & self ) -> impl DoubleEndedIterator < Item = ( usize , & ' _ str ) > {
281
+ fn split_word_bound_indices ( & self ) -> UWordBoundIndices {
280
282
word:: new_word_bound_indices ( self )
281
283
}
282
284
0 commit comments