検索

phrase: max: clip:
target: order:
Results of 11 - 20 of about 33 for Vec (0.032 sec.)
エラー型を定義する - Rust By Example 日本語版 8294
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... を提供する 他の型との比較を楽にする 良い例: Err(EmptyVec) 悪い例: Err("Please use a vector with at least on ... 、原因は記録されていない。 None } } fn double_first(vec: Vec<&str>) -> Result<i32> { vec.first() // Change ... ln!("Error: {}", e), } } fn main() { let numbers = vec!["42", "93", "18"]; let empty = vec![]; let string ... s = vec!["tofu", "93", "18"]; print(double_first(numbers)) ...
https://man.plustar.jp/rust/example/error/multiple_error_types/define_error_type... - [similar]
Iterator::find - Rust By Example 日本語版 8294
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... P: FnMut(&Self::Item) -> bool {} } fn main() { let vec1 = vec![1, 2, 3]; let vec2 = vec![4, 5, 6]; // `it ... er()` for vecs yields `&i32`. // ベクトル型に対する`iter`は`&i32 ... `を`yield`する。 let mut iter = vec1.iter(); // `into_iter()` for vecs yields `i32`. / ... )`の場合は`i32`を`yield`する。 let mut into_iter = vec2.into_iter(); // `iter()` for vecs yields `&i32`, ...
https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_find.html - [similar]
ハッシュ集合 - Rust By Example 日本語版 8294
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... のラッパーです。) 「何の意味があるの?フツーにキーを Vec に入れればいいじゃん」そう思いましたね? それは、 H ... ns::HashSet; fn main() { let mut a: HashSet<i32> = vec![1i32, 2, 3].into_iter().collect(); let mut b: Has ... hSet<i32> = vec![2i32, 3, 4].into_iter().collect(); assert!(a.inse ... リント println!("Union: {:?}", a.union(&b).collect::<Vec<&i32>>()); // This should print [1] // これは[1]を ...
https://man.plustar.jp/rust/example/std/hash/hashset.html - [similar]
?の他の活用法 - Rust By Example 日本語版 8037
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... x<dyn error::Error>>; #[derive(Debug)] struct EmptyVec; impl fmt::Display for EmptyVec { fn fmt(&self, f: ... st item to double") } } impl error::Error for EmptyVec {} // The same structure as before but rather than ... ?`で内部の値をその場で取得します。 fn double_first(vec: Vec<&str>) -> Result<i32> { let first = vec.first ... ().ok_or(EmptyVec)?; let parsed = first.parse::<i32>()?; Ok(2 * pars ...
https://man.plustar.jp/rust/example/error/multiple_error_types/reenter_question_... - [similar]
エラーをラップする - Rust By Example 日本語版 8037
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... leError>; #[derive(Debug)] enum DoubleError { EmptyVec, // We will defer to the parse error implementatio ... ) -> fmt::Result { match *self { DoubleError::EmptyVec => write!(f, "please use a vector with at least on ... rror + 'static)> { match *self { DoubleError::EmptyVec => None, // The cause is the underlying implementa ... rror { DoubleError::Parse(err) } } fn double_first(vec: Vec<&str>) -> Result<i32> { let first = vec.first ...
https://man.plustar.jp/rust/example/error/multiple_error_types/wrap_error.html - [similar]
要素の捕捉 - Rust By Example 日本語版 7283
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... を取ることをクロージャに強制します。 fn main() { // `Vec` has non-copy semantics. // `Vec`はコピーセマンティ ... クスではない。 let haystack = vec![1, 2, 3]; let contains = move |needle| haystack.c ... ontains(&4)); // println!("There're {} elements in vec", haystack.len()); // ^ Uncommenting above line wi ...
https://man.plustar.jp/rust/example/fn/closures/capture.html - [similar]
複数のジェネリック境界 - Rust By Example 日本語版 7283
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... { let string = "words"; let array = [1, 2, 3]; let vec = vec![1, 2, 3]; compare_prints(&string); //compar ... アンコメントしてみましょう。 compare_types(&array, &vec); } 参照 std::fmt , トレイト 関連キーワード: 複数 ...
https://man.plustar.jp/rust/example/generics/multi_bounds.html - [similar]
ディスプレイ - Rust By Example 日本語版 7283
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> のようなジェネリックなコンテナ用に定義されている ...
https://man.plustar.jp/rust/example/hello/print/print_display.html - [similar]
Where句 - Rust By Example 日本語版 7219
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... println!("{:?}", Some(self)); } } fn main() { let vec = vec![1, 2, 3]; vec.print_in_option(); } 参照 RFC ...
https://man.plustar.jp/rust/example/generics/where.html - [similar]
Iterator::any - Rust By Example 日本語版 7155
Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2. ... F: FnMut(Self::Item) -> bool {} } fn main() { let vec1 = vec![1, 2, 3]; let vec2 = vec![4, 5, 6]; // `it ... er()` for vecs yields `&i32`. Destructure to `i32`. // ベクトル型 ... eld`するので、`i32`へとデストラクト println!("2 in vec1: {}", vec1.iter() .any(|&x| x == 2)); // `into_it ... er()` for vecs yields `i32`. No destructuring required. // `into ...
https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_any.html - [similar]
PREV 1 2 3 4 NEXT