mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-11-03 21:49:42 -09:00
Zig 0.16: Fix Style enum generation
This commit is contained in:
parent
1b3d0a670e
commit
614e1a96c1
1 changed files with 11 additions and 14 deletions
25
src/ui.zig
25
src/ui.zig
|
|
@ -280,21 +280,18 @@ const styles = [_]StyleDef{
|
|||
};
|
||||
|
||||
pub const Style = lbl: {
|
||||
var fields: [styles.len]std.builtin.Type.EnumField = undefined;
|
||||
for (&fields, styles, 0..) |*field, s, i| {
|
||||
field.* = .{
|
||||
.name = s.name,
|
||||
.value = i,
|
||||
};
|
||||
var field_names: [styles.len][]const u8 = undefined;
|
||||
var field_values: [styles.len]u8 = undefined;
|
||||
for (&field_names, &field_values, styles, 0..) |*field_name, *field_value, s, i| {
|
||||
field_name.* = s.name;
|
||||
field_value.* = i;
|
||||
}
|
||||
break :lbl @Type(.{
|
||||
.@"enum" = .{
|
||||
.tag_type = u8,
|
||||
.fields = &fields,
|
||||
.decls = &[_]std.builtin.Type.Declaration{},
|
||||
.is_exhaustive = true,
|
||||
}
|
||||
});
|
||||
break :lbl @Enum(
|
||||
u8,
|
||||
.exhaustive,
|
||||
&field_names,
|
||||
&field_values,
|
||||
);
|
||||
};
|
||||
|
||||
const ui = @This();
|
||||
|
|
|
|||
Loading…
Reference in a new issue