the trait bound `std::io::Write + 'static: std::marker::Sized` is not satisfied, when passing closure
<p>I am trying to get rid of some code duplication in my program and I decided to go with a function that will take a closure of type <code>Fn() -&gt; Result&lt;io::Write&gt;</code> that will supply for me an output stream when I ask for it.</p>

<p>So here is this function:</p>

<pre><code>fn dowload_body&lt;F&gt;(/* some params ommited */ write_supplier: F) -&gt; Result&lt;()&gt;
  where F: Fn() -&gt; Result&lt;Write&gt; {
  if ... {
    let mut destination = try!(write_supplier());
    // use this stream
  }
}
</code></pre>

<p>And I want to use it for example like this:</p>

<pre><code>let destination_path = Path::new("some path");
let result = Self::dowload_body(|| try_str!(OpenOptions::new().append(true).open(destination_path)));
</code></pre>

<p>I am getting following error:</p>

<pre><code>src/http.rs:105:3: 121:4 error: the trait bound `std::io::Write + 'static: std::marker::Sized` is not satisfied [E0277]
src/http.rs:105   fn dowload_body&lt;F&gt;(write_supplier: F) -&gt; Result&lt;()&gt;
                  ^
</code></pre>

<p>I am new to rust and had no luck finding a solution.</p>