mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
359 B
19 lines
359 B
3 years ago
|
fn main() {
|
||
|
// ANCHOR: here
|
||
|
type Thunk = Box<dyn Fn() + Send + 'static>;
|
||
|
|
||
|
let f: Thunk = Box::new(|| println!("hi"));
|
||
|
|
||
|
fn takes_long_type(f: Thunk) {
|
||
|
// --snip--
|
||
|
}
|
||
|
|
||
|
fn returns_long_type() -> Thunk {
|
||
|
// --snip--
|
||
|
// ANCHOR_END: here
|
||
|
Box::new(|| ())
|
||
|
// ANCHOR: here
|
||
|
}
|
||
|
// ANCHOR_END: here
|
||
|
}
|