pub fn initDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self default: ?Valueinit_values: EnumFieldStruct(E, Value, default)1078
1079
1080
1081
1082
1083
1084
1085
1086
1087 pub fn initDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self {
@setEvalBranchQuota(2 * @typeInfo(E).@"enum".field_names.len);
var result: Self = .{ .values = undefined };
inline for (0..Self.len) |i| {
const key = comptime Indexer.keyForIndex(i);
const tag = @tagName(key);
result.values[i] = @field(init_values, tag);
}
return result;
}
Initializes values in the enum array, with the specified default.