© Carlo Milanesi 2018
Carlo MilanesiBeginning Rusthttps://doi.org/10.1007/978-1-4842-3468-6_18

18. Using Traits

Carlo Milanesi1 
(1)
Bergamo, Italy
 
In this chapter, you will learn:
  • How traits can avoid incomprehensible compiler error messages when invoking generic functions

  • How the bounding of a generic parameter can be monolithic, or it can be broken up in several traits

  • How traits create a scope for the functions they contain

  • How to use the "self" keyword to create functions that can be invoked using the “dot notation”, with a simpler syntax

  • How to use the standard library traits, like the "Display" trait

  • How iterating is just a trait

  • How to define type aliases

  • How to define generic iterators

  • How to use associated types to simplify generic iterators use ...

Get Beginning Rust: From Novice to Professional now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.