title: How do I return a Filter iterator from a function?
body: <p>I want something like that:</p>
  
  <pre><code>fn filter_one&lt;'a, T: Int&gt;(input: &amp;'a Vec&lt;T&gt;) -&gt; ??? {
      input.iter().filter(|&amp;x| x == Int::one())
  }
  </code></pre>
  
  <p>What's the return type of that function? (I want to return the Iterator)</p>
  
  <p>(I hope this isn't too obvious, I've been trying for half an hour now and am just starting to get frustrated :p )</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I tried to follow the instructions from <a href="https://stackoverflow.com/questions/27535289/correct-way-to-return-an-iterator">here</a> => <a href="http://is.gd/SZK4mM" rel="noreferrer">playpen link</a></p>
  
  <p>the compiler gives me the following error:</p>
  
  <pre><code>&lt;anon&gt;:5:1: 7:2 error: the trait `core::kinds::Sized` is not implemented for the type `for&lt;'r&gt; core::ops::Fn(&amp;'r T) -&gt; bool + 'a`
  &lt;anon&gt;:5 fn filter_one&lt;'a, T: Int&gt;(input: &amp;'a Vec&lt;T&gt;) -&gt; Filter&lt;&amp;T, Iter&lt;'a, T&gt;, Fn(&amp;T) -&gt; bool&gt;{
  &lt;anon&gt;:6     input.iter().filter(|&amp;x| x == Int::one())
  &lt;anon&gt;:7 }
  &lt;anon&gt;:5:1: 7:2 note: required by `core::iter::Filter`
  &lt;anon&gt;:5 fn filter_one&lt;'a, T: Int&gt;(input: &amp;'a Vec&lt;T&gt;) -&gt; Filter&lt;&amp;T, Iter&lt;'a, T&gt;, Fn(&amp;T) -&gt; bool&gt;{
  &lt;anon&gt;:6     input.iter().filter(|&amp;x| x == Int::one())
  &lt;anon&gt;:7 }
  &lt;anon&gt;:5:1: 7:2 error: the trait `for&lt;'r&gt; core::ops::Fn(&amp;'r &amp;'a T) -&gt; bool` is not implemented for the type `for&lt;'r&gt; core::ops::Fn(&amp;'r T) -&gt; bool + 'a`
  &lt;anon&gt;:5 fn filter_one&lt;'a, T: Int&gt;(input: &amp;'a Vec&lt;T&gt;) -&gt; Filter&lt;&amp;T, Iter&lt;'a, T&gt;, Fn(&amp;T) -&gt; bool&gt;{
  &lt;anon&gt;:6     input.iter().filter(|&amp;x| x == Int::one())
  &lt;anon&gt;:7 }
  &lt;anon&gt;:5:1: 7:2 note: required by `core::iter::Filter`
  &lt;anon&gt;:5 fn filter_one&lt;'a, T: Int&gt;(input: &amp;'a Vec&lt;T&gt;) -&gt; Filter&lt;&amp;T, Iter&lt;'a, T&gt;, Fn(&amp;T) -&gt; bool&gt;{
  &lt;anon&gt;:6     input.iter().filter(|&amp;x| x == Int::one())
  &lt;anon&gt;:7 }
  error: aborting due to 2 previous errors
  playpen: application terminated with error code 101
  </code></pre>
  
  <p>How do I tell <code>rustc</code> that <code>Fn(&amp;T) -&gt; bool</code> is <code>Sized?</code>?</p>