Rust allows you to write blocks implthat apply only to a specific combination of type parameters. For instance:
struct GenericVal<T>(T);
impl GenericVal<u32> {
fn foo(&self) {
}
}
Here the type GenericValis common, but implnot itself .
, impl, GenericVal<T>, impl ( T T).
struct GenericVal<T>(T);
impl<T> GenericVal<T> {
fn foo(&self) {
}
}
, , .
struct GenericVal<T, U>(T, U);
impl<V> GenericVal<V, V> {
fn foo(&self) {
}
}