the default value can’t be null if .comptime = true
this is the “working” solution
pub fn frame(comptime _scema: type) !type {
switch (@typeInfo(_scema)) {
.Struct => |st| {
var Struc_fields: [st.fields.len]std.builtin.Type.StructField = undefined;
for (st.fields, 0..) |F, i| {
Struc_fields[i] = .{
.name = F.name,
.type = column(F.type),
.default_value = null,
.is_comptime = false,
.alignment = 4,
};
}
const ret: type = @Type(.{ .Struct = .{
.fields = &Struc_fields,
.layout = .auto,
.is_tuple = false,
.decls = &.{},
} });
return ret;
},
else => {
@compileError("Not a struct");
},
}
}