title: Idiomatic way of binding function arguments and passing around bound functions
body: <p>Is there an idiomatic Rust way of binding function arguments and producing a new function?</p>
  
  <p>For example, suppose I had the following functions:</p>
  
  <pre><code>fn eq(a: i32) -&gt; Box&lt;Fn(i32) -&gt; bool&gt; {
      let target = a;  // copy
      Box::new(move |value| value == target)
  }
  
  fn evaluate(func: Box&lt;Fn(i32) -&gt; bool&gt;, value: i32) -&gt; bool {
      func(value)
  }
  </code></pre>
  
  <p>Is the <code>Box</code> mechanism used by <code>eq</code> a sane way of binding an argument to a function for usage in <code>evaluate</code>? e.g. something like this:</p>
  
  <pre><code>let is_42 = eq(42);
  assert_eq!(true, evaluate(is_42, 42));
  </code></pre>
  
  <p>There's also the issue of lifetimes. I'm wondering what the correct semantics would be for extending the lifetime of <code>target</code> in <code>eq()</code>, so its lifetime is bound to the lifetime of the boxed function.</p>