upgrade servicemodel.zig

This commit is contained in:
Emil Lerch 2023-08-04 16:39:15 -07:00
parent 46cc57ac2d
commit 5be18af930
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -5,13 +5,13 @@ const expectEqualStrings = std.testing.expectEqualStrings;
pub fn Services(comptime service_imports: anytype) type {
if (service_imports.len == 0) return services;
// From here, the fields of our structure can be generated at comptime...
var fields: [serviceCount(service_imports)]std.builtin.TypeInfo.StructField = undefined;
var fields: [serviceCount(service_imports)]std.builtin.Type.StructField = undefined;
for (fields, 0..) |*item, i| {
for (&fields, 0..) |*item, i| {
const import_field = @field(service_list, @tagName(service_imports[i]));
item.* = .{
.name = @tagName(service_imports[i]),
.field_type = @TypeOf(import_field),
.type = @TypeOf(import_field),
.default_value = &import_field,
.is_comptime = false,
.alignment = 0,
@ -23,7 +23,7 @@ pub fn Services(comptime service_imports: anytype) type {
.Struct = .{
.layout = .Auto,
.fields = &fields,
.decls = &[_]std.builtin.TypeInfo.Declaration{},
.decls = &[_]std.builtin.Type.Declaration{},
.is_tuple = false,
},
});