title: Why doesn't a trait implementation compile for a struct, but it compiles for a reference to the struct?
body: <p>To answer one of my previous questions (<a href="https://stackoverflow.com/questions/55669730/how-to-implement-a-generic-trait-with-a-generic-type-implementing-iterator?noredirect=1#comment98027325_55669730">How to implement a generic trait with a generic type implementing Iterator?</a>),
  this chunk of code was given to me:</p>
  
  <pre class="lang-rust prettyprint-override"><code>pub trait Vector {
      type Item;
      type Iter: Iterator&lt;Item = Self::Item&gt;;
  
      // several functions
      fn iter(&amp;self) -&gt; Self::Iter;
  }
  
  pub struct VectorImplementation1&lt;T&gt; {
      numbers: Vec&lt;T&gt;,
  }
  
  impl&lt;'a, T&gt; Vector for &amp;'a VectorImplementation1&lt;T&gt; {
      type Item = &amp;'a T;
      type Iter = std::slice::Iter&lt;'a, T&gt;;
  
      fn iter(&amp;self) -&gt; Self::Iter {
          self.numbers.iter()
      }
  }
  
  fn main() {}
  </code></pre>
  
  <p>I see that the trait is implemented for a reference of struct, and it doesn't compile if I use only a struct. Can someone explain why?</p>