[rust-dev] Interfaces!

Marijn Haverbeke marijnh at gmail.com
Thu Jan 5 11:16:39 PST 2012


> If I write "impl foo for bar" does that define an impl
> named `foo` with no interface, or an impl of the interface `foo`?

No interface.

> In that case, I write "impl of foo for bar" to get an impl of
> the interface `foo` named `foo` for the type `bar`?

Correct. How is this inconsistent? There's an optional `of` clause to
specify the interface. As an abbreviation, you can leave off the
proper name when you want to use the name of the interface (and you
specified one).


More information about the Rust-dev mailing list