Given a "New Type"
struct MyState(bool);
and a "normal" struct
struct MyState
{
value: bool,
}
Are these two structs the same, except for naming self.0 and self.value?
Are they both zero-cost abstractions?
Are these two structs the same, except of naming self.0 and self.value ?
Yes
Are they both zero-cost abstractions ?
Yes
Tuple structs in general are just structs whose fields don’t have names.
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