検索

phrase: max: clip:
target: order:
Results of 1 - 8 of about 8 for ParseIntError (0.018 sec.)
エラーをラップする - Rust By Example 日本語版 12055
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ::error; use std::error::Error as _; use std::num::ParseIntError; use std::fmt; type Result<T> = std::result::Resul ... 型により多くのデータを追加する必要があります。 Parse(ParseIntError), } impl fmt::Display for DoubleError { fn fmt(&se ... > Some(e), } } } // Implement the conversion from `ParseIntError` to `DoubleError`. // This will be automatically c ... alled by `?` if a `ParseIntError` // needs to be converted into a `DoubleError`. // ...
https://man.plustar.jp/rust/example/error/multiple_error_types/wrap_error.html - [similar]
Resultのmap - Rust By Example 日本語版 10826
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 実装された parse() を見てみましょう。結果、 Err 型は ParseIntError というものであることが分かります。 以下の例では、単 ... 体として扱いづらいコードにしています。 use std::num::ParseIntError; // With the return type rewritten, we use pattern ... str: &str, second_number_str: &str) -> Result<i32, ParseIntError> { match first_number_str.parse::<i32>() { Ok(firs ... Err(e) => Err(e), } } fn print(result: Result<i32, ParseIntError>) { match result { Ok(n) => println!("n is {}", n) ...
https://man.plustar.jp/rust/example/error/result/result_map.html - [similar]
?の導入 - Rust By Example 日本語版 10284
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... どれだけ簡潔に書けるか見てみましょう。 use std::num::ParseIntError; fn multiply(first_number_str: &str, second_number ... _str: &str) -> Result<i32, ParseIntError> { let first_number = first_number_str.parse::<i32 ... er * second_number) } fn print(result: Result<i32, ParseIntError>) { match result { Ok(n) => println!("n is {}", n) ... ion`の値を"2015"に変更してください。 use std::num::ParseIntError; fn multiply(first_number_str: &str, second_number ...
https://man.plustar.jp/rust/example/error/result/enter_question_mark.html - [similar]
Resultに対するエイリアス - Rust By Example 日本語版 9199
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... です! 簡単な例で構文を見てみましょう。 use std::num::ParseIntError; // Define a generic alias for a `Result` with the ... error type `ParseIntError`. // `ParseIntError`を`Err`の型として持つ全ての`Re ... ネリックエイリアス type AliasedResult<T> = Result<T, ParseIntError>; // Use the above alias to refer to our specific ... エラー , By , Example , Rust , second , 定義 , map , ParseIntError ...
https://man.plustar.jp/rust/example/error/result/result_alias.html - [similar]
OptionからResultを取り出す - Rust By Example 日本語版 8513
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 単にお互いを埋め込んでしまうことです。 use std::num::ParseIntError; fn double_first(vec: Vec<&str>) -> Option<Result< ... i32, ParseIntError>> { vec.first().map(|first| { first.parse::<i32>() ... ption をスワップすることができます。 use std::num::ParseIntError; fn double_first(vec: Vec<&str>) -> Result<Option< ... i32>, ParseIntError> { let opt = vec.first().map(|first| { first.parse ...
https://man.plustar.jp/rust/example/error/multiple_error_types/option_result.htm... - [similar]
早期リターン - Rust By Example 日本語版 7844
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... の新たなバージョンを考えてみましょう。 use std::num::ParseIntError; fn multiply(first_number_str: &str, second_number ... _str: &str) -> Result<i32, ParseIntError> { let first_number = match first_number_str.parse ... er * second_number) } fn print(result: Result<i32, ParseIntError>) { match result { Ok(n) => println!("n is {}", n) ...
https://man.plustar.jp/rust/example/error/result/early_returns.html - [similar]
Result - Rust By Example 日本語版 7030
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... 節 でカバーする内容に触れていきます。 use std::num::ParseIntError; fn main() -> Result<(), ParseIntError> { let numb ...
https://man.plustar.jp/rust/example/error/result.html - [similar]
複数のエラー型 - Rust By Example 日本語版 6488
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... Option を返し、一方で parse::<i32> は Result<i32, ParseIntError> を返しています。 fn double_first(vec: Vec<&str>) ...
https://man.plustar.jp/rust/example/error/multiple_error_types.html - [similar]
PREV 1 NEXT