#A usefull feature ngl
1 messages · Page 1 of 1 (latest)
1 messages · Page 1 of 1 (latest)
Ive been using zig for about 6 months at this point and a friend of mine showed me this which I think more people should know about
pub const MyNum = enum(u32) {
pi = 3,
_,
pub fn toU32(self: @This()) u32 {
return @intFromEnum(self);
}
};
Basicaly allowes you to have a type with methods and such with it still having good alignment
That is just a number