trpl-zh-cn/listings/ch20-advanced-features/listing-20-24/src/main.rs
2024-10-20 23:44:05 +08:00

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
}