@@ -373,7 +373,7 @@ <h1 id='基礎' class='section-header'><a href='#基礎'>基礎</a></h1>
373
373
< span class ='rusttest '> // Guess a number between 1 and 10.
374
374
// If it matches the number we had in mind, return true. Else, return false.
375
375
// 1から10までの数字を予想します。
376
- // もし予想した数字に一致したらtrueを返し、そうでなけれは、falseを返します 。
376
+ // もし予想した数字に一致したらtrueを返し、そうでなければfalseを返します 。
377
377
fn guess(n: i32) -> bool {
378
378
if n < 1 || n > 10 {
379
379
panic!("Invalid number: {}", n);
@@ -386,7 +386,7 @@ <h1 id='基礎' class='section-header'><a href='#基礎'>基礎</a></h1>
386
386
}
387
387
</ span > < pre class ='rust rust-example-rendered '>
388
388
< span class ='comment '> // 1から10までの数字を予想します。</ span >
389
- < span class ='comment '> // もし予想した数字に一致したらtrueを返し、そうでなけれは、falseを返します 。</ span >
389
+ < span class ='comment '> // もし予想した数字に一致したらtrueを返し、そうでなければfalseを返します 。</ span >
390
390
< span class ='kw '> fn</ span > < span class ='ident '> guess</ span > (< span class ='ident '> n</ span > : < span class ='ident '> i32</ span > ) < span class ='op '> -></ span > < span class ='ident '> bool</ span > {
391
391
< span class ='kw '> if</ span > < span class ='ident '> n</ span > < span class ='op '> <</ span > < span class ='number '> 1</ span > < span class ='op '> ||</ span > < span class ='ident '> n</ span > < span class ='op '> ></ span > < span class ='number '> 10</ span > {
392
392
< span class ='macro '> panic</ span > < span class ='macro '> !</ span > (< span class ='string '> "Invalid number: {}"</ span > , < span class ='ident '> n</ span > );
@@ -675,7 +675,7 @@ <h3 id='option-型' class='section-header'><a href='#option-型'><code>Option</c
675
675
< p > 訳注:</ p >
676
676
677
677
< p > called < code > Option::unwrap()</ code > on a < code > None</ code > value:< br />
678
- < code > None</ code > な値に対して < code > Option:unwpal ()</ code > が呼ばれました</ p >
678
+ < code > None</ code > な値に対して < code > Option:unwrap ()</ code > が呼ばれました</ p >
679
679
</ blockquote >
680
680
681
681
<!-- The `unwrap` method *abstracts away the case analysis*. This is precisely the thing -->
@@ -1992,7 +1992,7 @@ <h2 id='コンビネータの限界' class='section-header'><a href='#コンビ
1992
1992
1993
1993
< p > このコードは、やや難解になってきました。
1994
1994
このようなコードを簡単に書けるようになるまでには、結構な量の練習が必要かもしれません。
1995
- こういうもの書くときは < em > 型に導かれる</ em > ようにします。
1995
+ こういうものを書くときは < em > 型に導かれる</ em > ようにします。
1996
1996
< code > file_double</ code > のリターン型を < code > Result<i32, String></ code > に変更したらすぐに、それに合ったコンビネータを探し始めるのです。
1997
1997
この例では < code > and_then</ code > , < code > map</ code > , < code > map_err</ code > の、3種類のコンビネータだけを使いました。</ p >
1998
1998
@@ -2006,7 +2006,7 @@ <h2 id='コンビネータの限界' class='section-header'><a href='#コンビ
2006
2006
2007
2007
< p > < code > and_then</ code > は、エラーを返すかもしれない処理同士を繋いでいくために使います。
2008
2008
ファイルを開いた後に、失敗するかもしれない処理が2つあります:
2009
- ファイルからの読み込む所と 、内容を数値としてパースする所です。
2009
+ ファイルから読み込む所と 、内容を数値としてパースする所です。
2010
2010
これに対応して < code > and_then</ code > も2回呼ばれています。</ p >
2011
2011
2012
2012
<!-- `map` is used to apply a function to the `Ok(...)` value of a `Result`. For -->
@@ -3046,7 +3046,7 @@ <h2 id='独自のエラー型を合成する' class='section-header'><a href='#
3046
3046
3047
3047
<!-- is opaque to callers. -->
3048
3048
3049
- < p > 最後の節では < code > try!</ code > マクロの本当の定義を確認し、それが < code > From::from</ code > をエラーの値に対して呼ぶことで、自動的な型変換をする様子を見ました。
3049
+ < p > 前の節では < code > try!</ code > マクロの本当の定義を確認し、それが < code > From::from</ code > をエラーの値に対して呼ぶことで、自動的な型変換をする様子を見ました。
3050
3050
特にそこでは、エラーを < code > Box<Error></ code > に変換しました。
3051
3051
これはたしかに動きますが、呼び出し元にとって、型がオペークになってしまいました。</ p >
3052
3052
@@ -3495,11 +3495,11 @@ <h2 id='引数のパース' class='section-header'><a href='#引数のパース'
3495
3495
3496
3496
let matches = match opts.parse(&args[1..]) {
3497
3497
Ok(m) => { m }
3498
- Err(e) => { panic!(e.to_string()) }
3498
+ Err(e) => { panic!(e.to_string()) }
3499
3499
};
3500
3500
if matches.opt_present("h") {
3501
3501
print_usage(&program, opts);
3502
- return;
3502
+ return;
3503
3503
}
3504
3504
let data_path = args[1].clone();
3505
3505
let city = args[2].clone();
@@ -3527,11 +3527,11 @@ <h2 id='引数のパース' class='section-header'><a href='#引数のパース'
3527
3527
3528
3528
< span class ='kw '> let</ span > < span class ='ident '> matches</ span > < span class ='op '> =</ span > < span class ='kw '> match</ span > < span class ='ident '> opts</ span > .< span class ='ident '> parse</ span > (< span class ='kw-2 '> &</ span > < span class ='ident '> args</ span > [< span class ='number '> 1</ span > ..]) {
3529
3529
< span class ='prelude-val '> Ok</ span > (< span class ='ident '> m</ span > ) < span class ='op '> =></ span > { < span class ='ident '> m</ span > }
3530
- < span class ='prelude-val '> Err</ span > (< span class ='ident '> e</ span > ) < span class ='op '> =></ span > { < span class ='macro '> panic</ span > < span class ='macro '> !</ span > (< span class ='ident '> e</ span > .< span class ='ident '> to_string</ span > ()) }
3530
+ < span class ='prelude-val '> Err</ span > (< span class ='ident '> e</ span > ) < span class ='op '> =></ span > { < span class ='macro '> panic</ span > < span class ='macro '> !</ span > (< span class ='ident '> e</ span > .< span class ='ident '> to_string</ span > ()) }
3531
3531
};
3532
3532
< span class ='kw '> if</ span > < span class ='ident '> matches</ span > .< span class ='ident '> opt_present</ span > (< span class ='string '> "h"</ span > ) {
3533
3533
< span class ='ident '> print_usage</ span > (< span class ='kw-2 '> &</ span > < span class ='ident '> program</ span > , < span class ='ident '> opts</ span > );
3534
- < span class ='kw '> return</ span > ;
3534
+ < span class ='kw '> return</ span > ;
3535
3535
}
3536
3536
< span class ='kw '> let</ span > < span class ='ident '> data_path</ span > < span class ='op '> =</ span > < span class ='ident '> args</ span > [< span class ='number '> 1</ span > ].< span class ='ident '> clone</ span > ();
3537
3537
< span class ='kw '> let</ span > < span class ='ident '> city</ span > < span class ='op '> =</ span > < span class ='ident '> args</ span > [< span class ='number '> 2</ span > ].< span class ='ident '> clone</ span > ();
0 commit comments