mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-23 21:02:18 +08:00
17 lines
384 B
Rust
17 lines
384 B
Rust
|
fn main() {
|
||
|
// ANCHOR: here
|
||
|
let f: Box<dyn Fn() + Send + 'static> = Box::new(|| println!("hi"));
|
||
|
|
||
|
fn takes_long_type(f: Box<dyn Fn() + Send + 'static>) {
|
||
|
// --snip--
|
||
|
}
|
||
|
|
||
|
fn returns_long_type() -> Box<dyn Fn() + Send + 'static> {
|
||
|
// --snip--
|
||
|
// ANCHOR_END: here
|
||
|
Box::new(|| ())
|
||
|
// ANCHOR: here
|
||
|
}
|
||
|
// ANCHOR_END: here
|
||
|
}
|