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

Commitfe89bc6

Browse files
committed
Updated edition to 2018
1 parent8f9bd66 commitfe89bc6

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

‎Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name = "unicode-segmentation"
44
version ="1.7.1"
55
authors = ["kwantam <kwantam@gmail.com>","Manish Goregaokar <manishsmail@gmail.com>"]
66

7+
edition ="2018"
78
homepage ="https://github.com/unicode-rs/unicode-segmentation"
89
repository ="https://github.com/unicode-rs/unicode-segmentation"
910
documentation ="https://unicode-rs.github.io/unicode-segmentation"

‎src/grapheme.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use core::cmp;
1212

13-
use tables::grapheme::GraphemeCat;
13+
usecrate::tables::grapheme::GraphemeCat;
1414

1515
/// External iterator for grapheme clusters and byte offsets.
1616
///
@@ -229,7 +229,7 @@ enum PairResult {
229229
}
230230

231231
fncheck_pair(before:GraphemeCat,after:GraphemeCat) ->PairResult{
232-
use tables::grapheme::GraphemeCat::*;
232+
usecrate::tables::grapheme::GraphemeCat::*;
233233
useself::PairResult::*;
234234
match(before, after){
235235
(GC_CR,GC_LF) =>NotBreak,// GB3
@@ -295,8 +295,8 @@ impl GraphemeCursor {
295295
}
296296

297297
fngrapheme_category(&mutself,ch:char) ->GraphemeCat{
298-
use tables::graphemeas gr;
299-
use tables::grapheme::GraphemeCat::*;
298+
usecrate::tables::graphemeas gr;
299+
usecrate::tables::grapheme::GraphemeCat::*;
300300

301301
if ch <='\u{7e}'{
302302
// Special-case optimization for ascii, except U+007F. This
@@ -387,7 +387,7 @@ impl GraphemeCursor {
387387
/// assert_eq!(cursor.is_boundary(&flags[8..], 8), Ok(true));
388388
/// ```
389389
pubfnprovide_context(&mutself,chunk:&str,chunk_start:usize){
390-
use tables::graphemeas gr;
390+
usecrate::tables::graphemeas gr;
391391
assert!(chunk_start + chunk.len() ==self.pre_context_offset.unwrap());
392392
self.pre_context_offset =None;
393393
ifself.is_extended && chunk_start + chunk.len() ==self.offset{
@@ -433,7 +433,7 @@ impl GraphemeCursor {
433433
}
434434

435435
fnhandle_regional(&mutself,chunk:&str,chunk_start:usize){
436-
use tables::graphemeas gr;
436+
usecrate::tables::graphemeas gr;
437437
letmut ris_count =self.ris_count.unwrap_or(0);
438438
for chin chunk.chars().rev(){
439439
ifself.grapheme_category(ch) != gr::GC_Regional_Indicator{
@@ -453,7 +453,7 @@ impl GraphemeCursor {
453453
}
454454

455455
fnhandle_emoji(&mutself,chunk:&str,chunk_start:usize){
456-
use tables::graphemeas gr;
456+
usecrate::tables::graphemeas gr;
457457
letmut iter = chunk.chars().rev();
458458
ifletSome(ch) = iter.next(){
459459
ifself.grapheme_category(ch) != gr::GC_ZWJ{
@@ -506,7 +506,7 @@ impl GraphemeCursor {
506506
/// assert_eq!(cursor.is_boundary(flags, 0), Ok(false));
507507
/// ```
508508
pubfnis_boundary(&mutself,chunk:&str,chunk_start:usize) ->Result<bool,GraphemeIncomplete>{
509-
use tables::graphemeas gr;
509+
usecrate::tables::graphemeas gr;
510510
ifself.state ==GraphemeState::Break{
511511
returnOk(true)
512512
}

‎src/sentence.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use core::iter::Filter;
1313

1414
// All of the logic for forward iteration over sentences
1515
mod fwd{
16-
use tables::sentence::SentenceCat;
16+
usecrate::tables::sentence::SentenceCat;
1717
use core::cmp;
1818

1919
// Describe a parsed part of source string as described in this table:
@@ -111,7 +111,7 @@ mod fwd {
111111
if parts[idx] ==StatePart::ClosePlus{ idx -=1}
112112

113113
if parts[idx] ==StatePart::ATerm{
114-
use tables::sentenceas se;
114+
usecrate::tables::sentenceas se;
115115

116116
for next_charin ahead.chars(){
117117
//( ¬(OLetter | Upper | Lower | ParaSep | SATerm) )* Lower
@@ -176,7 +176,7 @@ mod fwd {
176176

177177
#[inline]
178178
fnnext(&mutself) ->Option<usize>{
179-
use tables::sentenceas se;
179+
usecrate::tables::sentenceas se;
180180

181181
for next_charinself.string[self.pos..].chars(){
182182
let position_before =self.pos;
@@ -331,7 +331,7 @@ pub fn new_sentence_bound_indices<'a>(source: &'a str) -> USentenceBoundIndices<
331331
#[inline]
332332
pubfnnew_unicode_sentences<'b>(s:&'bstr) ->UnicodeSentences<'b>{
333333
usesuper::UnicodeSegmentation;
334-
use tables::util::is_alphanumeric;
334+
usecrate::tables::util::is_alphanumeric;
335335

336336
fnhas_alphanumeric(s:&&str) ->bool{ s.chars().any(|c|is_alphanumeric(c))}
337337
let has_alphanumeric:fn(&&str) ->bool = has_alphanumeric;// coerce to fn pointer

‎src/word.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use core::cmp;
1212
use core::iter::Filter;
1313

14-
use tables::word::WordCat;
14+
usecrate::tables::word::WordCat;
1515

1616
/// An iterator over the substrings of a string which, after splitting the string on
1717
/// [word boundaries](http://www.unicode.org/reports/tr29/#Word_Boundaries),
@@ -142,7 +142,7 @@ enum RegionalState {
142142
}
143143

144144
fnis_emoji(ch:char) ->bool{
145-
use tables::emoji;
145+
usecrate::tables::emoji;
146146
emoji::emoji_category(ch).2 == emoji::EmojiCat::EC_Extended_Pictographic
147147
}
148148

@@ -159,7 +159,7 @@ impl<'a> Iterator for UWordBounds<'a> {
159159
fnnext(&mutself) ->Option<&'astr>{
160160
useself::UWordBoundsState::*;
161161
useself::FormatExtendType::*;
162-
use tables::wordas wd;
162+
usecrate::tables::wordas wd;
163163
ifself.string.len() ==0{
164164
returnNone;
165165
}
@@ -386,7 +386,7 @@ impl<'a> DoubleEndedIterator for UWordBounds<'a> {
386386
fnnext_back(&mutself) ->Option<&'astr>{
387387
useself::UWordBoundsState::*;
388388
useself::FormatExtendType::*;
389-
use tables::wordas wd;
389+
usecrate::tables::wordas wd;
390390
ifself.string.len() ==0{
391391
returnNone;
392392
}
@@ -638,7 +638,7 @@ impl<'a> UWordBounds<'a> {
638638

639639
#[inline]
640640
fnget_next_cat(&self,idx:usize) ->Option<WordCat>{
641-
use tables::wordas wd;
641+
usecrate::tables::wordas wd;
642642
let nidx = idx +self.string[idx..].chars().next().unwrap().len_utf8();
643643
if nidx <self.string.len(){
644644
let nch =self.string[nidx..].chars().next().unwrap();
@@ -650,7 +650,7 @@ impl<'a> UWordBounds<'a> {
650650

651651
#[inline]
652652
fnget_prev_cat(&self,idx:usize) ->Option<WordCat>{
653-
use tables::wordas wd;
653+
usecrate::tables::wordas wd;
654654
if idx >0{
655655
let nch =self.string[..idx].chars().next_back().unwrap();
656656
Some(wd::word_category(nch).2)
@@ -673,7 +673,7 @@ pub fn new_word_bound_indices<'b>(s: &'b str) -> UWordBoundIndices<'b> {
673673
#[inline]
674674
pubfnnew_unicode_words<'b>(s:&'bstr) ->UnicodeWords<'b>{
675675
usesuper::UnicodeSegmentation;
676-
use tables::util::is_alphanumeric;
676+
usecrate::tables::util::is_alphanumeric;
677677

678678
fnhas_alphanumeric(s:&&str) ->bool{ s.chars().any(|c|is_alphanumeric(c))}
679679
let has_alphanumeric:fn(&&str) ->bool = has_alphanumeric;// coerce to fn pointer

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp