Skip to content

Traits and TypeclassesΒΆ

To the best of my knowledge, the idea of traits in rust is based on the idea of Typeclasses found in Haskell and other pure functional languages. I'm not certain on how they differ, but the idea of stating the equivalent of an interface and then letting data structures implement that interface while wiring up the details under the hood is common.

Question

how exactly do these differ?