mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 12:39:42 +00:00
Typo Fixed evironment
to environment
This commit is contained in:
@ -245,7 +245,7 @@ fn main() {
|
|||||||
10.
|
10.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
/* Fill in the blank and fix the errror */
|
/* Fill in the blank and fix the error */
|
||||||
// You can also use `impl FnOnce(i32) -> i32`
|
// You can also use `impl FnOnce(i32) -> i32`
|
||||||
fn create_fn() -> impl Fn(i32) -> i32 {
|
fn create_fn() -> impl Fn(i32) -> i32 {
|
||||||
let num = 5;
|
let num = 5;
|
||||||
@ -261,11 +261,11 @@ fn main() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
/* Fill in the blank and fix the errror */
|
/* Fill in the blank and fix the error */
|
||||||
fn create_fn() -> Box<dyn Fn(i32) -> i32> {
|
fn create_fn() -> Box<dyn Fn(i32) -> i32> {
|
||||||
let num = 5;
|
let num = 5;
|
||||||
|
|
||||||
// how does the following closure capture the evironment variable `num`
|
// how does the following closure capture the environment variable `num`
|
||||||
// &T, &mut T, T ?
|
// &T, &mut T, T ?
|
||||||
Box::new(move |x| x + num)
|
Box::new(move |x| x + num)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user