title: How would you create a constructor for a struct containing a closure?
body: <p>How would I go about implementing a method that acts as a constructor for a struct that contains a closure?  I'm new to Rust, and what with closures being actively worked on I'm having a hard time finding a solution in the documentation.</p>
  
  <pre><code>struct A&lt;'self&gt; {
      fOne: &amp;'self fn(),
  }
  
  impl&lt;'self&gt; A&lt;'self&gt; {
      fn new() {
          println!("Ideally this would return a struct of type A");
      }
  }
  
  fn run(f: &amp;fn()) {
      f();
  }
  
  fn main() {
      let apples = 5;
      let example = A {
          fOne: || {
              println!("{} apples on the tree.", apples);
          },
      };
      A::new();
  
      run(example.fOne);
  }
  </code></pre>
  
  <p>This is as far as I can get without running into a host of issues.  I can't seem to create a version of <code>A::new()</code> that accepts a closure as an argument, creates a struct of type <code>A</code> with that argument, and then returns the newly created struct.  Is there a way to do this, or if not, what don't I understand?</p>