5656) ]
5757#![ no_std]
5858
59+ #[ cfg( test) ]
60+ extern crate std;
61+
5962pub use grapheme:: { GraphemeCursor , GraphemeIncomplete } ;
6063pub use grapheme:: { GraphemeIndices , Graphemes } ;
6164pub use sentence:: { USentenceBoundIndices , USentenceBounds , UnicodeSentences } ;
6265pub use tables:: UNICODE_VERSION ;
63- pub use word:: { UWordBoundIndices , UWordBounds , UnicodeWordIndices , UnicodeWords } ;
66+ pub use word:: { UWordBoundIndices , UWordBounds } ;
6467
6568mod grapheme;
6669mod sentence;
@@ -133,7 +136,7 @@ pub trait UnicodeSegmentation {
133136 ///
134137 /// assert_eq!(&uw1[..], b);
135138 /// ```
136- fn unicode_words ( & self ) -> UnicodeWords < ' _ > ;
139+ fn unicode_words ( & self ) -> impl Iterator < Item = & ' _ str > ;
137140
138141 /// Returns an iterator over the words of `self`, separated on
139142 /// [UAX#29 word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries), and their
@@ -157,7 +160,7 @@ pub trait UnicodeSegmentation {
157160 ///
158161 /// assert_eq!(&uwi1[..], b);
159162 /// ```
160- fn unicode_word_indices ( & self ) -> UnicodeWordIndices < ' _ > ;
163+ fn unicode_word_indices ( & self ) -> impl Iterator < Item = ( usize , & ' _ str ) > ;
161164
162165 /// Returns an iterator over substrings of `self` separated on
163166 /// [UAX#29 word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries).
@@ -173,7 +176,7 @@ pub trait UnicodeSegmentation {
173176 ///
174177 /// assert_eq!(&swu1[..], b);
175178 /// ```
176- fn split_word_bounds ( & self ) -> UWordBounds < ' _ > ;
179+ fn split_word_bounds ( & self ) -> impl DoubleEndedIterator < Item = & ' _ str > ;
177180
178181 /// Returns an iterator over substrings of `self`, split on UAX#29 word boundaries,
179182 /// and their offsets. See `split_word_bounds()` for more information.
@@ -188,7 +191,7 @@ pub trait UnicodeSegmentation {
188191 ///
189192 /// assert_eq!(&swi1[..], b);
190193 /// ```
191- fn split_word_bound_indices ( & self ) -> UWordBoundIndices < ' _ > ;
194+ fn split_word_bound_indices ( & self ) -> impl DoubleEndedIterator < Item = ( usize , & ' _ str ) > ;
192195
193196 /// Returns an iterator over substrings of `self` separated on
194197 /// [UAX#29 sentence boundaries](http://www.unicode.org/reports/tr29/#Sentence_Boundaries).
@@ -210,7 +213,7 @@ pub trait UnicodeSegmentation {
210213 ///
211214 /// assert_eq!(&us1[..], b);
212215 /// ```
213- fn unicode_sentences ( & self ) -> UnicodeSentences < ' _ > ;
216+ fn unicode_sentences ( & self ) -> impl Iterator < Item = & ' _ str > ;
214217
215218 /// Returns an iterator over substrings of `self` separated on
216219 /// [UAX#29 sentence boundaries](http://www.unicode.org/reports/tr29/#Sentence_Boundaries).
@@ -258,27 +261,27 @@ impl UnicodeSegmentation for str {
258261 }
259262
260263 #[ inline]
261- fn unicode_words ( & self ) -> UnicodeWords {
264+ fn unicode_words ( & self ) -> impl Iterator < Item = & ' _ str > {
262265 word:: new_unicode_words ( self )
263266 }
264267
265268 #[ inline]
266- fn unicode_word_indices ( & self ) -> UnicodeWordIndices {
269+ fn unicode_word_indices ( & self ) -> impl Iterator < Item = ( usize , & ' _ str ) > {
267270 word:: new_unicode_word_indices ( self )
268271 }
269272
270273 #[ inline]
271- fn split_word_bounds ( & self ) -> UWordBounds {
274+ fn split_word_bounds ( & self ) -> impl DoubleEndedIterator < Item = & ' _ str > {
272275 word:: new_word_bounds ( self )
273276 }
274277
275278 #[ inline]
276- fn split_word_bound_indices ( & self ) -> UWordBoundIndices {
279+ fn split_word_bound_indices ( & self ) -> impl DoubleEndedIterator < Item = ( usize , & ' _ str ) > {
277280 word:: new_word_bound_indices ( self )
278281 }
279282
280283 #[ inline]
281- fn unicode_sentences ( & self ) -> UnicodeSentences {
284+ fn unicode_sentences ( & self ) -> impl Iterator < Item = & ' _ str > {
282285 sentence:: new_unicode_sentences ( self )
283286 }
284287
0 commit comments