検索
Results of 1 - 10 of about 10 for closure (0.005 sec.)
- 要素の捕捉 - Rust By Example 日本語版 12281
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...std::mem; let color = String::from("green"); // A closure to print `color` which immediately borrows (`&`) `...color` and // stores the borrow and closure in the `print` variable. It will remain // borrowe...t = || println!("`color`: {}", color); // Call the closure using the borrow. // 借用を行ったクロージャをコール...olor` can be borrowed immutably again, because the closure only holds // an immutable reference to `color`. /... - https://man.plustar.jp/rust/example/fn/closures/capture.html - [similar]
- クロージャ - Rust By Example 日本語版 10994
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...捉することができます。 fn main() { // Increment via closures and functions. // 関数とクロージャのそれぞれで数値...リメントする fn function(i: i32) -> i32 { i + 1 } // Closures are anonymous, here we are binding them to refere...なので、適切な変数にバインディングしてやるとよい let closure_annotated = |i: i32| -> i32 { i + 1 }; let closure...= |i | i + 1 ; let i = 1; // Call the function and closures. // 関数とクロージャを呼び出す。 println!("functi... - https://man.plustar.jp/rust/example/fn/closures.html - [similar]
- Rust By Example 日本語版 10905
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...捉することができます。 fn main() { // Increment via closures and functions. // 関数とクロージャのそれぞれで数値...リメントする fn function(i: i32) -> i32 { i + 1 } // Closures are anonymous, here we are binding them to refere...なので、適切な変数にバインディングしてやるとよい let closure_annotated = |i: i32| -> i32 { i + 1 }; let closure...= |i | i + 1 ; let i = 1; // Call the function and closures. // 関数とクロージャを呼び出す。 println!("functi... - https://man.plustar.jp/rust/example/print.html - [similar]
- impl Trait - Rust By Example 日本語版 8938
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...ust types can't be written out. For example, every closure has its own unnamed concrete type. Before impl Tra...u had to allocate on the heap in order to return a closure. But now you can do it all statically, like this:...dder_function(y: i32) -> impl Fn(i32) -> i32 { let closure = move |x: i32| { x + y }; closure } fn main() { l...rait to return an iterator that uses map or filter closures! This makes using map and filter easier. Because... - https://man.plustar.jp/rust/example/trait/impl_trait.html - [similar]
- 捕捉時の型推論 - Rust By Example 日本語版 8831
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...るのかを見てみましょう。 // A function which takes a closure as an argument and calls it. // <F> denotes that F...ric type parameter" fn apply<F>(f: F) where // The closure takes no input and returns nothing. // クロージャに...えてみましょう。 f(); } // A function which takes a closure and returns an `i32`. // クロージャを引数に取り、`...返す関数 fn apply_to_3<F>(f: F) -> i32 where // The closure takes an `i32` and returns an `i32`. // このクロー... - https://man.plustar.jp/rust/example/fn/closures/input_parameters.html - [similar]
- 関数を受け取る関数 - Rust By Example 日本語版 8634
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...tln!("I'm a function!"); } fn main() { // Define a closure satisfying the `Fn` bound // `Fn`境界を満たすクロー...ジャを定義 let closure = || println!("I'm a closure!"); call_me(closure);... - https://man.plustar.jp/rust/example/fn/closures/input_functions.html - [similar]
- Testcase: map-reduce - Rust By Example 日本語版 7544
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...urned value // // 'move || -> u32' is syntax for a closure that: // * takes no arguments ('||') // * takes ow...is smart enough to infer the '-> u32' from // the closure itself so we could have left that out. // // TODO:...of the program. 参照 Threads vectors and iterators closures , move semantics and move closures destructuring... - https://man.plustar.jp/rust/example/std_misc/threads/testcase_mapreduce.html - [similar]
- クロージャを受け取る関数 - Rust By Example 日本語版 7061
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...で対応しています。 // `F` must implement `Fn` for a closure which takes no // inputs and returns nothing - exa... - https://man.plustar.jp/rust/example/fn/closures/anonymity.html - [similar]
- Iterator::any - Rust By Example 日本語版 7061
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
.... `Self::Item` states it takes // arguments to the closure by value. // `FnMut`はクロージャによって補足される... - https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_any.html - [similar]
- Iterator::find - Rust By Example 日本語版 7061
- Introduction 1. Hello World ❱ 1.1. コメント 1.2. フォーマットしてプリント ❱ 1.2.1. デバッグ 1.2.
...`&Self::Item` states it takes // arguments to the closure by reference. // `FnMut`はクロージャによって補足さ... - https://man.plustar.jp/rust/example/fn/closures/closure_examples/iter_find.html - [similar]
PREV
1
NEXT