検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 19 for None (0.023 sec.)
Option - Rust By Example 日本語版 13438
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... なります。 列挙型 Option<T> には2つの値があります。 None 、これは実行の失敗か値の欠如を示します。 Some(valu ... f divisor == 0 { // Failure is represented as the `None` variant // 失敗は`None`としてあらわされる。 None ... できる。 match checked_division(dividend, divisor) { None => println!("{} / {} failed!", dividend, divisor), ... ry_division(4, 2); try_division(1, 0); // Binding `None` to a variable needs to be type annotated // `None ...
https://man.plustar.jp/rust/example/std/option.html - [similar]
Combinators: map - Rust By Example 日本語版 11833
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... くるでしょう。引数の値が有効である(訳注: この場合は None でない)必要がある関数を扱う際には特にそうです。 I ... l flow in a modular fashion. Some -> Some あるいは None -> None の単純な操作を適用する必要がある場合には、 ... // Peeling food. If there isn't any, then return `None`. // Otherwise, return the peeled food. // 食べ物の ... 皮をむく。存在しない場合は単純に`None`を返す。 // そうでなければ皮を向いた食べ物を返す。 ...
https://man.plustar.jp/rust/example/error/option_unwrap/map.html - [similar]
Combinators: and_then - Rust By Example 日本語版 10876
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 与えられた関数にラップされた値を渡しますが、その値が None だった場合は None を返します。 以下の例では cookab ... ood) -> Option<Food> { match food { Food::Sushi => None, _ => Some(food), } } // We have the recipe for ev ... -> Option<Food> { match food { Food::CordonBleu => None, _ => Some(food), } } // To make a dish, we need b ... Food) -> Option<Food> { match have_recipe(food) { None => None, Some(food) => match have_ingredients(food ...
https://man.plustar.jp/rust/example/error/option_unwrap/and_then.html - [similar]
Option と unwrap - Rust By Example 日本語版 9664
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 1つとして扱われます。 Some(T) : 型 T の値がある場合 None : 値が存在しない場合。 これらは match を用いて明示 ... , Some(inner) => println!("{}? How nice.", inner), None => println!("No drink? Oh well."), } } // Others w ... // `unwrap` returns a `panic` when it receives a `None`. // `unwrap`を使用すると値が`None`だった際に`pani ... ter"); let lemonade = Some("lemonade"); let void = None; give_adult(water); give_adult(lemonade); give_adu ...
https://man.plustar.jp/rust/example/error/option_unwrap.html - [similar]
イテレータ - Rust By Example 日本語版 9186
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... Option<T>`: // * When the `Iterator` is finished, `None` is returned. // * Otherwise, the next value is wr ... ption<T>`で、これは: // * `Iterator`が終了した時は`None`を返し、 // * そうでなければ`Some`でラップされた値 ... cci sequence, the `Iterator` // will never return `None`, and `Some` is always returned. // フィボナッチ数 ... 列には終端がないので、`Iterator`は決して // `None`を返さず、常に`Some`が返される。 Some(self.curr) } ...
https://man.plustar.jp/rust/example/trait/iter.html - [similar]
?によるOptionのアンパック - Rust By Example 日本語版 8947
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... れた値となり、そうでなければ実行中の関数を終了させ、 None を返します。 fn next_birthday(current_age: Option< ... u8>) -> Option<String> { // If `current_age` is `None`, this returns `None`. // If `current_age` is `Som ... u8` gets assigned to `next_age` // `current_age`が`None`の場合、`None`を返す。 // `current_age`が`Some`の場 ...
https://man.plustar.jp/rust/example/error/option_unwrap/question_mark.html - [similar]
OptionからResultを取り出す - Rust By Example 日本語版 7837
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 数字としてパースできない } 中には、 Option の中身が None の場合はそのまま処理を進め、エラーの検出に限り実行 ... st.parse::<i32>().map(|n| 2 * n) }); opt.map_or(Ok(None), |r| r.map(Some)) } fn main() { let numbers = vec ...
https://man.plustar.jp/rust/example/error/multiple_error_types/option_result.htm... - [similar]
if let - Rust By Example 日本語版 7752
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... `型 let number = Some(7); let letter: Option<i32> = None; let emoticon: Option<i32> = None; // The `if let` ...
https://man.plustar.jp/rust/example/flow_control/if_let.html - [similar]
while let - Rust By Example 日本語版 7752
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 9 { println!("Greater than 9, quit!"); optional = None; } else { println!("`i` is `{:?}`. Try again.", i) ... 9 { println!("Greater than 9, quit!"); optional = None; } else { println!("`i` is `{:?}`. Try again.", i) ...
https://man.plustar.jp/rust/example/flow_control/while_let.html - [similar]
Iterator::find - Rust By Example 日本語版 7752
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... たす最初の値を探します。もし条件を満たす値がなければ None を返します。型シグネチャは以下のようになります。 p ... < &0); assert_eq!(index_of_first_negative_number, None); } 参照 std::iter::Iterator::find std::iter::Iter ...
https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_find.html - [similar]
PREV 1 2 NEXT