How would you do the equivalent of this in Rust?<p><pre><code>  auto on_heap = std::make_unique&lt;MyType&gt;(...);

  function_that_accepts_lambda([obj = std::move(on_heap)]() {
     obj-&gt;bar(...);
  })</code></pre>