検索

phrase: max: clip:
target: order:
Results of 1 - 10 of about 33 for vec (0.024 sec.)
impl Trait - Rust By Example 日本語版 12882
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... nt<R: std::io::BufRead>(src: R) -> std::io::Result<Vec<Vec<String>>> { src.lines() .map(|line| { // For e ... .collect() // Collect all strings in a row into a Vec<String> }) }) .collect() // Collect all lines into ... a Vec<Vec<String>> } parse_csv_document is generic, allo ... ent(src: impl std::io::BufRead) -> std::io::Result<Vec<Vec<String>>> { src.lines() .map(|line| { // For e ...
https://man.plustar.jp/rust/example/trait/impl_trait.html - [similar]
Resultをイテレートする - Rust By Example 日本語版 11502
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ることもあります。例えば、 fn main() { let strings = vec!["tofu", "93", "18"]; let numbers: Vec<_> = string ... なるものだけ取り除きます。 fn main() { let strings = vec!["tofu", "93", "18"]; let numbers: Vec<_> = string ... で処理全体を失敗させる Result は、それらのベクトル( Vec<Result<T, E>> )からベクトルのそれ( Result<Vec<T>, ... テレーションは終了します。 fn main() { let strings = vec!["tofu", "93", "18"]; let numbers: Result<Vec<_>, ...
https://man.plustar.jp/rust/example/error/iter_result.html - [similar]
型推論 - Rust By Example 日本語版 11374
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ることがわかる。 let elem = 5u8; // Create an empty vector (a growable array). // 空のベクトル(可変長の配 ... 列)を生成 let mut vec = Vec::new(); // At this point the compiler doesn' ... t know the exact type of `vec`, it // just knows that it's a vector of something ... (`Vec<_>`). // この時点でコンパイラは`vec`の型を知らず、 ...
https://man.plustar.jp/rust/example/types/inference.html - [similar]
OptionからResultを取り出す - Rust By Example 日本語版 10363
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>().map(|n| ... 2 * n) }) } fn main() { let numbers = vec!["42", "93", "18"]; let empty = vec![]; let string ... s = vec!["tofu", "93", "18"]; println!("The first doubled ...
https://man.plustar.jp/rust/example/error/multiple_error_types/option_result.htm... - [similar]
テストケース: リスト - Rust By Example 日本語版 9930
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... : try!(write!(f, "{}", value)); ? を使用できれば、 Vec 用の fmt::Display はより簡単に実装できます。 use s ... . // Define a structure named `List` containing a `Vec`. // `Vec`を含む`List`という名の構造体を定義 struc ... t List(Vec<i32>); impl fmt::Display for List { fn fmt(&self, ... sing tuple indexing, // and create a reference to `vec`. let vec = &self.0; write!(f, "[")?; // Iterate o ...
https://man.plustar.jp/rust/example/hello/print/print_display/testcase_list.html - [similar]
Rust By Example 日本語版 9802
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... れば良いでしょう? 例えば、 std ライブラリがあらゆる Vec<T> に対して単一のスタイルを提供していた場合、どのよ ... いでしょう?以下の2つのどちらかを選ぶべきでしょうか? Vec<path> : /:/etc:/home/username:/bin ( : で分割) V ... が提供されているわけでもありません。 fmt::Display は Vec<T> のようなジェネリックなコンテナ用に定義されている ... : try!(write!(f, "{}", value)); ? を使用できれば、 Vec 用の fmt::Display はより簡単に実装できます。 use s ...
https://man.plustar.jp/rust/example/print.html - [similar]
複数のエラー型 - Rust By Example 日本語版 8534
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... の2つのインスタンスが異なるエラー型を生成します。 Vec::first は Option を返し、一方で parse::<i32> は Re ... 2, ParseIntError> を返しています。 fn double_first(vec: Vec<&str>) -> i32 { let first = vec.first().unwra ... ror 2 // エラー2の生成 } fn main() { let numbers = vec!["42", "93", "18"]; let empty = vec![]; let string ... s = vec!["tofu", "93", "18"]; println!("The first doubled ...
https://man.plustar.jp/rust/example/error/multiple_error_types.html - [similar]
エラーをBoxする - Rust By Example 日本語版 8470
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... rror::Error>>; #[derive(Debug, Clone)] struct EmptyVec; impl fmt::Display for EmptyVec { fn fmt(&self, f: ... st item to double") } } impl error::Error for EmptyVec {} fn double_first(vec: Vec<&str>) -> Result<i32> ... { vec.first() .ok_or_else(|| EmptyVec.into()) // Convert ... ln!("Error: {}", e), } } fn main() { let numbers = vec!["42", "93", "18"]; let empty = vec![]; let string ...
https://man.plustar.jp/rust/example/error/multiple_error_types/boxing_errors.htm... - [similar]
DRY (Don't Repeat Yourself) - Rust By Example 日本語版 8406
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... ードを書くのに役立ちます。ここでは += 、 *= 、 -= 、 Vec<T> を実装、テストするにあたって、マクロがどのように ... { fn $func<T: $bound<T, Output=T> + Copy>(xs: &mut Vec<T>, ys: &Vec<T>) { assert_equal_len!(xs, ys, $func ... ] fn $func() { for size in 0usize..10 { let mut x: Vec<_> = iter::repeat($x).take(size).collect(); let y: ... Vec<_> = iter::repeat($y).take(size).collect(); let z: ...
https://man.plustar.jp/rust/example/macros/dry.html - [similar]
ベクタ型 - Rust By Example 日本語版 8358
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... す。 fn main() { // Iterators can be collected into vectors // イテレータは要素を収集してベクタにすることが ... できる。 let collected_iterator: Vec<i32> = (0..10).collect(); println!("Collected (0.. ... 10) into: {:?}", collected_iterator); // The `vec!` macro can be used to initialize a vector // ベク ... タの初期化には`vec!`マクロが使用できる。 let mut xs = vec![1i32, 2, 3 ...
https://man.plustar.jp/rust/example/std/vec.html - [similar]
PREV 1 2 3 4 NEXT