Pass function with parameter as an argument
examples/advanced-functions/pass-function-with-parameter-as-argument/src/main.rs
fn main() { call(hello); } fn hello(text: &str) { println!("Hello {}", text); } fn call(my_function: fn(text: &str) -> ()) { my_function("Foo"); my_function("Bar"); }
Hello Foo Hello Bar