That way it will support ==. enum is preferred because then == .nil will work. packed struct is a one line and probably nonbreaking change.
eg:
- return extern struct {
+ return enum (Id) {
...
- id: Id = 0,
- pub const nil = Self{ .id = 0 };
+ nil = 0,
+ _,
+ pub fn id(self: Self) Id {
+ return @intFromEnum(self);
+ }
And then you can do:
if (some_handle == .nil) ...
if (handle_a == handle_b) ...
That way it will support
==. enum is preferred because then== .nilwill work. packed struct is a one line and probably nonbreaking change.eg:
And then you can do: