title: How to clone a function pointer
body: <p>I have a structure with a field which is a function pointer. I want to implement the <code>Clone</code> trait for that struct, but I can't because function pointers can't be cloned if they have at least one parameter:</p>
  
  <pre><code>fn my_fn(s: &amp;str) {
      println!("in my_fn {}", s);
  }
  
  type TypeFn = fn(s: &amp;str);
  
  #[derive(Clone)]
  struct MyStruct {
      field: TypeFn
  }
  
  fn main() {
      let my_var = MyStruct{field: my_fn};
      let _ = my_var.clone();
  }
  </code></pre>
  
  <p><a href="https://play.rust-lang.org/?gist=49be325af14c6e3c071b&amp;version=stable" rel="noreferrer">Link to playground</a>.</p>