|
|
|
|
|
by johncolanduoni
3884 days ago
|
|
I think it's more about Rust's approach to OO. In Rust, traits are usually used as interfaces for generics instead of dynamic dispatch. The generated code/performance is more like what you would get if you implemented them explicitly for each appropriate type in C, built around structs. You could do this with C++ templates, but it would be a huge pain in that language due to lack of template type safety. This is a quite important part of Rust (IMHO) because it gives the language a performance profile closer to C than C++ in many instances. |
|