title: Implementing a trait on HashMap that uses methods with bounds
body: <p>I have the following trait that I want to implement on HashMaps:</p>
  
  <pre><code>trait IdAssigner&lt;K, V&gt; {
      // If key has already been seen, returns (id_for_key, false). Otherwise
      // assigns a new id_for_key (starting with 0 and increasing) and returns
      // (id_for_key, true).
      fn assign_id(mut self, key: K) -&gt; (V, bool);
  }
  
  impl&lt;K, V&gt; IdAssigner&lt;K, V&gt; for HashMap&lt;K, V&gt; where V: Add&lt;V&gt; {
      fn assign_id(mut self, key: K) -&gt; (V, bool) {
          if self.contains_key(&amp;key) {
              (self[&amp;key], false)
          } else {
              let id = self.len() as V;
              self[&amp;key] = id;
              (id, true)
          }
      }
  }
  </code></pre>
  
  <p>The compiler gives various errors about the methods I want to call in the implementation on the HashMap don't exist. I suspect that I need to add the same bounds to my impl statement that exist on those methods. How do I fix this code?</p>
  
  <p><a href="https://play.rust-lang.org/?gist=53b2a0c12a5834da6fb4&amp;version=stable" rel="nofollow">Playground</a></p>