title: Tying the return type of a method in a trait to the type thats implimenting the trait
body: <p>I have a trait <code>Vertex</code> that I want several structs to implement. I want to require a structs that implement the trait to have a method that returns a Vector of that struct. So the implementation would look something like this.</p>
  <pre class="lang-rust prettyprint-override"><code>struct Point {
      // ...
  }
  
  impl Vertex for Point {
      fn from_byte_buffer(buffer: &amp;[u8]) -&gt; Vec&lt;Self&gt; {
          unimplemented!()
      }
  }
  </code></pre>
  <p>That way you can call it like <code>Point::from_byte_buffer(...)</code>. However I'm lost as to how to write the method signature in the trait. This was my best guess.</p>
  <pre class="lang-rust prettyprint-override"><code>trait Vertex {
      fn from_byte_buffer(buffer: &amp;[u8]) -&gt; Vec&lt;Self&gt;;
  }
  </code></pre>
  <p>However, this gives me an error,</p>
  <pre class="lang-none prettyprint-override"><code>the size for values of type `Self` cannot be known at compilation time
  </code></pre>
  <p>which kinda makes sense 'cuz in this context Self is not a concrete type. I thought about doing something like this,</p>
  <pre class="lang-rust prettyprint-override"><code>trait Vertex {
      fn from_byte_buffer&lt;V: Vertex&gt;(buffer: &amp;[u8]) -&gt; Vec&lt;V&gt;;
  }
  </code></pre>
  <p>but then that's not tied to the concrete type that is implementing the trait. Do I need to use associated types or something?</p>