fn fields(comptime T: type) switch (@typeInfo(T)) { .Struct => []const Type.StructField, .Union => []const Type.UnionField, .ErrorSet => []const Type.Error, .Enum => []const Type.EnumField, else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), }
[src]