-
Homework 2 due today!
-
Remember to email before the deadline to use late days (either the 4 freebies or additional late days) -- so that we make sure to delay grading your assignment.
-
Add/drop deadline tomorrrow! Hoping to get grades back by then.
-
Homework 3 later than initially planned. Will be posted soon, likely due April 1.
Traits: Traits are like Copy
, Clone
, Debug
, and Eq
.
Traits define shared behavior across different types.
-
Implementing a trait for a type
-
Overview of standard library traits
Traits continued:
-
More advanced (e.g.
Deref
,StructOpt
,Serde
) -
Defining your own traits
Generics:
Generics are like Vec<T>
.
Generics are how you generalize data structures and functions, making them
work for different parameter types.
-
Writing generic functions
-
Making structs (and their methods) generic
-
Using traits to enable truly generic programming
Some additional utility traits are described in the optional material more_utility_traits.rs
, to complement what we discussed in class.