

Rust's ownership model for JavaScript developers - steveklabnik
http://blog.thoughtram.io/rust/2015/05/11/rusts-ownership-model-for-javascript-developers.html

======
EugeneOZ
Again noob question about syntax:

> impl<'a> ProductService<'a>

I understand why <'a> is here, but why repeated twice?

~~~
steveklabnik
The first one defines the list of all parameters, and the second uses it. In
short definitions like this, it seems redundant, but it's more obvious with a
more complex example:

    
    
        impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
            where K: Eq + Hash + Borrow<Q>,
                  Q: Eq + Hash,
                  S: HashState
    

Okay, maybe that's not obvious, I picked a really gross example on purpose. :)

The first part says "we're generic over five things: 'a, K, Q, V, and S. And
then each of those five things gets used various times in the rest of the
definition.

