What is the difference between
type CMoves = Vec<Move>;
and
struct CMoves(Vec<Move>);
I understand I can implement traits with the second one, but I cannot with the first one as Vec
is defined outside of my crate. Are there any other differences, for example with memory representation?
A type alias is just that, an alias. Pure syntactic sugar with no bearing on semantics. For all intents and purposes you could just replace all of the alias name with what it aliases.
On the other hand, a tuple struct is an entirely separate type, with all that entails:
As such, the two are nothing alike.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With