News for hackers. Stuff that matters.
Re:When zero cost abstractions aren't zero cost by tialaramex on Monday August 09, 2021 @11:34PM (#28124912)
Rust wrapper types aren't like C++ typedef. If you just want an alias for the u8 type in Rust, you get the exact same performance:

type Tiny = u8;

The compiler knows a "Tiny" is just a u8 anyway and exactly the same code is produced.

The wrapper type is a distinct type, which is why you'd want one because it can have different properties from whatever it's wrapping.

There are no comments on this comment yet.