After reading The Book, I was wondering if it presented a dumbed down version of the type system… I didn’t see anything about covariant or contravariant type parameters. Is this supported in Rust or is everything invariant only? i.e. https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
The short answer is that there is no subtyping in Rust
The long answer is that there is subtyping in Rust, but only for lifetimes, and there are variance rules about them (automatically derived from the data type definitions). However in practice you don’t think about them most of the time, because everything just works (I’ve written a moderate amount of Rust code, and I think I know about lifetime variance only in theory).