In this episode of Crust of Rust, we go over static and dynamic dispatch in Rust by diving deep into generics, monomorphization, and trait objects. As part of that, we also discuss what exactly the Sized trait is, what it’s for, and how it interacts with Dynamically Sized traits.
You can read more about Rust monomorphization in the Rust book at https://doc.rust-lang.org/book/ch10-01-syntax.html?highlight=performance#performance-of-code-using-generics. It also has some good discussion about Trait Objects (https://doc.rust-lang.org/book/ch17-02-trait-objects.html) and Dynamically Sized Types (https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait). For more details, the Rust reference also has more details on Trait Objects (https://doc.rust-lang.org/nightly/reference/types/trait-object.html) and Object Safety (https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety), and so does the Rustonomicon (https://doc.rust-lang.org/nomicon/exotic-sizes.html).
#rust #programming #developer