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

Commit63bf614

Browse files
committed
Add several doc tests
2 parents45e13d5 +2e88e27 commit63bf614

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

‎src/kana.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,35 @@ fn shift_code<F,G>(judge: F, convert: G, src: &str) -> String
7171
/// Convert Wide-alphanumeric into normal ASCII [A -> A]
7272
/// # Examples
7373
/// ```
74-
/// let s3 = "#&Rust-1.6!";
75-
/// assert_eq!("#&Rust-1.6!", kana::wide2ascii(s3));
74+
/// assert_eq!("#&Rust-1.6!", kana::wide2ascii("#&Rust-1.6!"));
7675
/// ```
7776
pubfnwide2ascii(s:&str) ->String{
7877
shift_code(|x|0xff00 < x && x <0xff5f, |x| x -0xfee0, s)
7978
}
8079

8180
/// Convert normal ASCII characters into Wide-alphanumeric [A -> A]
81+
/// # Examples
82+
/// ```
83+
/// assert_eq!("#&Rust-1.6!", kana::ascii2wide("#&Rust-1.6!"));
84+
/// ```
8285
pubfnascii2wide(s:&str) ->String{
8386
shift_code(|x|0x0020 < x && x <0x007f, |x| x +0xfee0, s)
8487
}
8588

8689
/// Convert Hiragana into Katakana [あ -> ア]
90+
/// # Examples
91+
/// ```
92+
/// assert_eq!("イロハ", kana::hira2kata("いろは"));
93+
/// ```
8794
pubfnhira2kata(s:&str) ->String{
8895
shift_code(|x|0x3041 < x && x <0x3096, |x| x +0x0060, s)
8996
}
9097

9198
/// Convert Katakana into Hiragana [ア -> あ]
99+
/// # Examples
100+
/// ```
101+
/// assert_eq!("いろは", kana::kata2hira("イロハ"));
102+
/// ```
92103
pubfnkata2hira(s:&str) ->String{
93104
shift_code(|x|0x30A1 < x && x <0x30F6, |x| x -0x0060, s)
94105
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp