upgrade servicemodel.zig
This commit is contained in:
parent
46cc57ac2d
commit
5be18af930
|
@ -5,13 +5,13 @@ const expectEqualStrings = std.testing.expectEqualStrings;
|
||||||
pub fn Services(comptime service_imports: anytype) type {
|
pub fn Services(comptime service_imports: anytype) type {
|
||||||
if (service_imports.len == 0) return services;
|
if (service_imports.len == 0) return services;
|
||||||
// From here, the fields of our structure can be generated at comptime...
|
// 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]));
|
const import_field = @field(service_list, @tagName(service_imports[i]));
|
||||||
item.* = .{
|
item.* = .{
|
||||||
.name = @tagName(service_imports[i]),
|
.name = @tagName(service_imports[i]),
|
||||||
.field_type = @TypeOf(import_field),
|
.type = @TypeOf(import_field),
|
||||||
.default_value = &import_field,
|
.default_value = &import_field,
|
||||||
.is_comptime = false,
|
.is_comptime = false,
|
||||||
.alignment = 0,
|
.alignment = 0,
|
||||||
|
@ -23,7 +23,7 @@ pub fn Services(comptime service_imports: anytype) type {
|
||||||
.Struct = .{
|
.Struct = .{
|
||||||
.layout = .Auto,
|
.layout = .Auto,
|
||||||
.fields = &fields,
|
.fields = &fields,
|
||||||
.decls = &[_]std.builtin.TypeInfo.Declaration{},
|
.decls = &[_]std.builtin.Type.Declaration{},
|
||||||
.is_tuple = false,
|
.is_tuple = false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user