検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 36 for Some (0.023 sec.)
if let - Rust By Example 日本語版 11189
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... `という変数の型を`Option<i32>`に指定 let optional = Some(7); match optional { Some(i) => { println!("This i ... `Option<i32>` // 全て`Option<i32>`型 let number = Some(7); let letter: Option<i32> = None; let emoticon: ... ct reads: "if `let` destructures `number` into // `Some(i)`, evaluate the block (`{}`). // `if let`文は以下 ... 意味. // // もしletがnumberをデストラクトした結果が`Some(i)`になるならば // ブロック内(`{}`)を実行する。 if ...
https://man.plustar.jp/rust/example/flow_control/if_let.html - [similar]
Combinators: map - Rust By Example 日本語版 10872
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... used to manage control flow in a modular fashion. Some -> Some あるいは None -> None の単純な操作を適用す ... od: Option<Food>) -> Option<Peeled> { match food { Some(food) => Some(Peeled(food)), None => None, } } // ... ption<Peeled>) -> Option<Chopped> { match peeled { Some(Peeled(food)) => Some(Chopped(food)), None => None ... すよね! fn eat(food: Option<Cooked>) { match food { Some(food) => println!("Mmm. I love {:?}", food), None ...
https://man.plustar.jp/rust/example/error/option_unwrap/map.html - [similar]
Option - Rust By Example 日本語版 10777
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ます。 None 、これは実行の失敗か値の欠如を示します。 Some(value) 、型 T の value をラップするタプルです。 // ... わされる。 None } else { // Result is wrapped in a `Some` variant // 結果は`Some`にラップされる。 Some(divi ... => println!("{} / {} failed!", dividend, divisor), Some(quotient) => { println!("{} / {} = {}", dividend, ... quivalent_none = None::<i32>; let optional_float = Some(0f32); // Unwrapping a `Some` variant will extract ...
https://man.plustar.jp/rust/example/std/option.html - [similar]
?によるOptionのアンパック - Rust By Example 日本語版 10666
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ion の x があるとすると、 x? を評価した値は、 x が Some の場合は x に格納された値となり、そうでなければ実行 ... one`, this returns `None`. // If `current_age` is `Some`, the inner `u8` gets assigned to `next_age` // `c ... `が`None`の場合、`None`を返す。 // `current_age`が`Some`の場合、内部の`u8`型の値が`next_age`に代入される。 ... let next_age: u8 = current_age?; Some(format!("Next year I will be {}", next_age)) } 多く ...
https://man.plustar.jp/rust/example/error/option_unwrap/question_mark.html - [similar]
while let - Rust By Example 日本語版 10666
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... `Option<i32>`の`optional`を作成 let mut optional = Some(0); // Repeatedly try this test. // 変数の照合を繰 ... `のデストラクトに成功した場合、値に応じて処理を分岐 Some(i) => { if i > 9 { println!("Greater than 9, quit! ... intln!("`i` is `{:?}`. Try again.", i); optional = Some(i + 1); } // ^ Requires 3 indentations! // ^ 3つも ... `Option<i32>`の`optional`を作成 let mut optional = Some(0); // This reads: "while `let` destructures `opti ...
https://man.plustar.jp/rust/example/flow_control/while_let.html - [similar]
Option と unwrap - Rust By Example 日本語版 9937
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... って、下記2つのパターンのうちの1つとして扱われます。 Some(T) : 型 T の値がある場合 None : 値が存在しない場合 ... すし、 unwrap で暗黙に処理することもできます。後者は Some の中の値を返すか panic するかのどちらかです。 expe ... fy a course of action for each case. match drink { Some("lemonade") => println!("Yuck! Too sugary."), Some ... love {}s!!!!!", inside); } fn main() { let water = Some("water"); let lemonade = Some("lemonade"); let voi ...
https://man.plustar.jp/rust/example/error/option_unwrap.html - [similar]
イテレータ - Rust By Example 日本語版 9842
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ned. // * Otherwise, the next value is wrapped in `Some` and returned. // We use Self::Item in the return ... r`が終了した時は`None`を返し、 // * そうでなければ`Some`でラップされた値を返す。 fn next(&mut self) -> Opt ... , the `Iterator` // will never return `None`, and `Some` is always returned. // フィボナッチ数列には終端が ... ないので、`Iterator`は決して // `None`を返さず、常に`Some`が返される。 Some(self.curr) } } // Returns a Fibo ...
https://man.plustar.jp/rust/example/trait/iter.html - [similar]
Rust By Example 日本語版 9731
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... リストを作成 let mut list = List::new(); // Prepend some elements // 要素を追加 list = list.prepend(1); lis ... fn is_big(n: i32) -> bool { // Access constant in some function // 関数内から定数を参照 n > THRESHOLD } f ... e of `vec`, it // just knows that it's a vector of something (`Vec<_>`). // この時点でコンパイラは`vec`の型 ... "y is 2, i = {:?}", i), // and you can also ignore some variables: // 一部の変数を無視することもできる。 F ...
https://man.plustar.jp/rust/example/print.html - [similar]
Combinators: and_then - Rust By Example 日本語版 9525
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ion<Food> { match food { Food::Sushi => None, _ => Some(food), } } // We have the recipe for everything ex ... ood> { match food { Food::CordonBleu => None, _ => Some(food), } } // To make a dish, we need both the rec ... on<Food> { match have_recipe(food) { None => None, Some(food) => match have_ingredients(food) { None => No ... ne, Some(food) => Some(food), }, } } // This can convenient ...
https://man.plustar.jp/rust/example/error/option_unwrap/and_then.html - [similar]
バインディング - Rust By Example 日本語版 9224
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... o "destructure" enum variants, such as Option : fn some_number() -> Option<u32> { Some(42) } fn main() { m ... atch some_number() { // Got `Some` variant, match if its val ... ue, bound to `n`, // is equal to 42. Some(n @ 42) => println!("The Answer: {}!", n), // Matc ... h any other number. Some(n) => println!("Not interesting... {}", n), // Mat ...
https://man.plustar.jp/rust/example/flow_control/match/binding.html - [similar]
PREV 1 2 3 4 NEXT