okay stupid question but how do generics work in Rust on the compiler level?
in cpp, you can only have instantiations of a template in the same compilation unit as the template itself. Like, you can’t have a templated class in myType.cpp and the interface for that class in myType.h because during compile time, the compiler needs to know what code to generate, and what types to generate it for, and it can’t do that unless the templated class definitions are present in the compilation unit.
so what does Rust do? copy-paste stdlib types with generics into your main.rs file so that all the correct types can be generated for that compilation unit?
please, someone smart, i need to know













