Overview
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore Rust's approach to inheritance and object-oriented programming in this 44-minute conference talk by Valentin Tolmer. Dive into the concept of Traits as an alternative to traditional inheritance, learning how to implement common programming patterns using this powerful Rust feature. Discover the differences between dynamic and static dispatch, understand associated types, and examine practical examples like the Iterator trait. Gain insights into complex topics such as returning complex types, the orphan rule, downcasting, and auto traits. Follow along with the provided slides to enhance your understanding of Rust's unique approach to code organization and reuse.
Syllabus
Intro
How does Java do it?
How does C++ do it?
How does Rust do it?
Rust Traits
How to use Traits: dynamic dispatch
How to use Traits: static dispatch
Examples of traits
Associated types
Example Iterator
Returning complex types
Why can't I print a vector?
The orphan rule
Downcasting: Create a new trait
Auto traits
Conclusion
Taught by
Rust