-
-
Notifications
You must be signed in to change notification settings - Fork 395
Open
Labels
bugSomething isn't workingSomething isn't working
Description
fn BuildFieldEnum(comptime T: type) type {
const fields = @typeInfo(T).@"struct".fields;
var enum_fields: [fields.len]std.builtin.Type.EnumField = undefined;
inline for (fields, 0..) |field, i| {
enum_fields[i] = .{
.name = field.name,
.value = i,
};
}
return @Type(.{ .@"enum" = .{
.decls = &.{},
.tag_type = u32,
.fields = &enum_fields,
.is_exhaustive = true,
} });
}const User = struct {
id: i64,
name: []const u8,
pub fn tableName() []const u8 {
return "users";
}
};const UserField = BuildFieldEnum(User);UserField is showing (unknown type)
zig version 0.15.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working