Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Rust - Generics, Traits, Lifetimes

The Dev Method via YouTube

Overview

Dive into the world of Rust programming with this comprehensive 36-minute tutorial on generics, traits, and lifetimes. Explore the concept of generics as placeholders for other types, using the analogy of a can that can hold various food items. Learn how to implement generics in your own functions, structs, and methods, building upon your existing knowledge of the `Option` and `Result` types. Discover the power of traits in defining behavior generically and unravel the mystery behind lifetimes, a crucial Rust feature often encountered in compiler error messages. Follow along with practical examples, including the implementation of a "Largest Function," and gain insights into monomorphization, trait bounds, and lifetime rules. Enhance your understanding of these advanced Rust concepts with references to Chapter 17 of the Rust Programming book and additional resources for complex scenarios involving lifetimes.

Syllabus

Introduction
Removing Duplication
Syntax
Generics
Generics in Methods
Monomorphization
Traits
Traits as Parameters
Example
Largest Function
Lifetimes
Rules
Illusion rules
Illusion rules with methods

Taught by

The Dev Method

Reviews

Start your review of Rust - Generics, Traits, Lifetimes

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.