title: How do you pass a Rust function as a parameter?
body: <p>Can I pass a function as a parameter? If not, what is a good alternative?</p>
  
  <p>I tried some different syntaxes but I have not found the right one. I know I can do this:</p>
  
  <pre><code>fn example() {
      let fun: fn(value: i32) -&gt; i32;
      fun = fun_test;
      fun(5i32);
  }
  
  fn fun_test(value: i32) -&gt; i32 {
      println!("{}", value);
      value
  }
  </code></pre>
  
  <p>but that's not passing the function as a parameter to another function:</p>
  
  <pre><code>fn fun_test(value: i32, (some_function_prototype)) -&gt; i32 {
      println!("{}", value);
      value
  }
  </code></pre>