Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteca9043

Browse files
committed
add ascii fastpath
1 parent592d99d commiteca9043

File tree

2 files changed

+196
-135
lines changed

2 files changed

+196
-135
lines changed

‎src/lib.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@
5656
)]
5757
#![no_std]
5858

59+
#[cfg(test)]
60+
externcrate std;
61+
5962
pubuse grapheme::{GraphemeCursor,GraphemeIncomplete};
6063
pubuse grapheme::{GraphemeIndices,Graphemes};
6164
pubuse sentence::{USentenceBoundIndices,USentenceBounds,UnicodeSentences};
6265
pubuse tables::UNICODE_VERSION;
63-
pubuse word::{UWordBoundIndices,UWordBounds,UnicodeWordIndices,UnicodeWords};
66+
pubuse word::{UWordBoundIndices,UWordBounds};
6467

6568
mod grapheme;
6669
mod sentence;
@@ -133,7 +136,7 @@ pub trait UnicodeSegmentation {
133136
///
134137
/// assert_eq!(&uw1[..], b);
135138
/// ```
136-
fnunicode_words(&self) ->UnicodeWords<'_>;
139+
fnunicode_words(&self) ->implIterator<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-
fnunicode_word_indices(&self) ->UnicodeWordIndices<'_>;
163+
fnunicode_word_indices(&self) ->implIterator<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-
fnsplit_word_bounds(&self) ->UWordBounds<'_>;
179+
fnsplit_word_bounds(&self) ->implDoubleEndedIterator<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-
fnsplit_word_bound_indices(&self) ->UWordBoundIndices<'_>;
194+
fnsplit_word_bound_indices(&self) ->implDoubleEndedIterator<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-
fnunicode_sentences(&self) ->UnicodeSentences<'_>;
216+
fnunicode_sentences(&self) ->implIterator<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-
fnunicode_words(&self) ->UnicodeWords{
264+
fnunicode_words(&self) ->implIterator<Item =&'_str>{
262265
word::new_unicode_words(self)
263266
}
264267

265268
#[inline]
266-
fnunicode_word_indices(&self) ->UnicodeWordIndices{
269+
fnunicode_word_indices(&self) ->implIterator<Item =(usize,&'_str)>{
267270
word::new_unicode_word_indices(self)
268271
}
269272

270273
#[inline]
271-
fnsplit_word_bounds(&self) ->UWordBounds{
274+
fnsplit_word_bounds(&self) ->implDoubleEndedIterator<Item =&'_str>{
272275
word::new_word_bounds(self)
273276
}
274277

275278
#[inline]
276-
fnsplit_word_bound_indices(&self) ->UWordBoundIndices{
279+
fnsplit_word_bound_indices(&self) ->implDoubleEndedIterator<Item =(usize,&'_str)>{
277280
word::new_word_bound_indices(self)
278281
}
279282

280283
#[inline]
281-
fnunicode_sentences(&self) ->UnicodeSentences{
284+
fnunicode_sentences(&self) ->implIterator<Item =&'_str>{
282285
sentence::new_unicode_sentences(self)
283286
}
284287

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp