CDERIVABLE TRAITS
In various places in the book, we’ve discussed the derive attribute, which you can apply to a struct or enum definition. The derive attribute generates code that will implement a trait with its own default implementation on the type you’ve annotated with the derive syntax.
In this appendix, we provide a reference of all the traits in the standard library that you can use with derive. Each section covers:
- What operators and methods deriving this trait will enable
- What the implementation of the trait provided by derive does
- What implementing the trait signifies about the type
- The conditions in which you’re allowed or not allowed ...
Get The Rust Programming Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.