Monomorphization

Generic code is turned into non-generic code based on the call sites:

1. fn main() {
2. let integer = Some(5);
3. let float = Some(5.0);
4. }

behaves as if you wrote

1. enum Option_i32 {
2. Some(i32),
3. None,
4. }

6. enum Option_f64 {
7. Some(f64),
8. None,
9. }

11. fn main() {
12. let integer = Option_i32::Some(5);
13. let float = Option_f64::Some(5.0);
14. }

This is a zero-cost abstraction: you get exactly the same result as if you had hand-coded the data structures without the abstraction.