We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
Trait Objects and Dispatch
RustHeterogeneous collections and the four-way choice between generics, `&dyn`, `Box<dyn>` and enum dispatch — decided by measurement rather than folklore.
This track is written for Rust, which isn't the mode you're browsing in.
0
/ 7 solved
· 3 articles
- 1. Not solved yet. Box<dyn Trait>: trait objects, DSTs and dynamic dispatch
- 2. Not solved yet. Dyn compatibility: the actual rules
- 3. Not solved yet. Static vs dynamic dispatch, measured
- 4. Not solved yet. Enum dispatch: the third option
- 5. Choosing between generics, impl Trait, &dyn, Box<dyn> and enums Read
- 6. Monomorphisation: what generics compile to, and what that costs Read
- 7. Not solved yet. Dispatch through Rc: Rc<dyn Trait> and shared behaviour
- 8. Not solved yet. Trait objects and lifetimes: Box<dyn Trait + 'a>
- 9. async fn in traits and RPITIT: what works and what does not Read
- 10. Not solved yet. Designing signatures: T, &T, &mut T, impl Into<T>
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
You need a collection holding several different types that all implement one trait. What must you use?
Vec<Box<dyn Shape>>
Vec<T> where T: Shape
Question 1 of 4