Week 12: Generics & traits

Introduction

This week you’ll learn how Rust achieves polymorphism without inheritance through traits and generics. Rust uses traits to define shared behavior and generics to write code that works with any type. You’ll build a generic Stack that works with integers, strings, or any other type—demonstrating Rust’s “write once, use everywhere” philosophy with zero runtime cost.

Lectures

Lab assignment