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

Commit0e7674a

Browse files
committed
remove pub
1 parentb556333 commit0e7674a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎src/word.rs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ impl<'a> UWordBounds<'a> {
756756
///
757757
/// Any other single ASCII byte is its own boundary (the default WB999).
758758
#[derive(Debug)]
759-
pubstructAsciiWordBoundIter<'a>{
759+
structAsciiWordBoundIter<'a>{
760760
rest:&'astr,
761761
offset:usize,
762762
}
@@ -988,7 +988,7 @@ pub fn new_word_bound_indices(s: &str) -> UWordBoundIndices<'_> {
988988
}
989989

990990
#[inline]
991-
pubfnnew_ascii_word_bound_indices(s:&str) ->AsciiWordBoundIter<'_>{
991+
fnnew_ascii_word_bound_indices(s:&str) ->AsciiWordBoundIter<'_>{
992992
AsciiWordBoundIter::new(s)
993993
}
994994

@@ -1046,6 +1046,20 @@ mod tests {
10461046
assert_eq!(cat, wd::WC_Numeric);
10471047
}
10481048

1049+
#[test]
1050+
fntest_ascii_word_bound_indices_various_cases(){
1051+
let s ="Hello, world!";
1052+
let words:Vec<(usize,&str)> =new_ascii_word_bound_indices(s).collect();
1053+
let expected =vec![
1054+
(0,"Hello"),// simple letters
1055+
(5,","),
1056+
(6," "),// space after comma
1057+
(7,"world"),// skip comma+space, stop at '!'
1058+
(12,"!"),// punctuation at the end
1059+
];
1060+
assert_eq!(words, expected);
1061+
}
1062+
10491063
#[test]
10501064
fntest_ascii_word_indices_various_cases(){
10511065
let s ="Hello, world! can't e.g. var1 123,456 foo_bar example.com 127.0.0.1:9090";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp