The compiler is capable of providing basic implementations for some traits via the #[deriving] attribute. These traits can still be manually implemented if a more complex behavior is required.
{deriving.play}
This is a list of the “derivable” traits:
Eq, PartialEq, Ord, PartialOrdEncodable, DecodableClone, to create T from &T via a copy.Hash, to compute a hash from &T.Rand, to create a random instance of a data type.Default, to create an empty instance of a data type.Zero, to create a zero instance of a numeric data type.FromPrimitive, to create an instance from a numeric primitive.Show, to format a value using the {} formatter.