mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Update solution closure.md
Changed order of bounds so that readers new to Rust won't be confused by "bool + Copy" and could comprehend it faster and better.
This commit is contained in:
@ -118,7 +118,7 @@ fn main() {
|
||||
```rust
|
||||
fn fn_once<F>(func: F)
|
||||
where
|
||||
F: FnOnce(usize) -> bool + Copy,// 改动在这里
|
||||
F: Copy + FnOnce(usize) -> bool,// 改动在这里
|
||||
{
|
||||
println!("{}", func(3));
|
||||
println!("{}", func(4));
|
||||
@ -293,4 +293,4 @@ fn factory(x:i32) -> Box<dyn Fn(i32) -> i32> {
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
```
|
||||
```
|
||||
|
Reference in New Issue
Block a user