authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-18 23:52:51 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-18 23:52:51 -08:00
log53ec18c2b1f857daa22da6ab37694eeaeda3911e
tree4784b862ceb73bf74b6fc4128416914f688afd60
parent518ffdd4b7e14c00aac078f9d19991de5b43b68a

StructOfSlices: support tuples


1 files changed, 3 insertions(+), 2 deletions(-)

src/StructOfSlices.zig+3-2
...@@ -4,7 +4,8 @@ const extras = @import("./lib.zig");...@@ -4,7 +4,8 @@ const extras = @import("./lib.zig");
4const expectSimilarType = extras.expectSimilarType;4const expectSimilarType = extras.expectSimilarType;
55
6pub fn StructOfSlices(T: type) type {6pub fn StructOfSlices(T: type) type {
7 const fields = std.meta.fields(T);7 const info = @typeInfo(T).@"struct";
8 const fields = info.fields;
8 var new_fields: [fields.len]std.builtin.Type.StructField = undefined;9 var new_fields: [fields.len]std.builtin.Type.StructField = undefined;
9 for (fields, 0..) |item, i| {10 for (fields, 0..) |item, i| {
10 new_fields[i] = .{11 new_fields[i] = .{
...@@ -21,7 +22,7 @@ pub fn StructOfSlices(T: type) type {...@@ -21,7 +22,7 @@ pub fn StructOfSlices(T: type) type {
21 .backing_integer = null,22 .backing_integer = null,
22 .fields = result,23 .fields = result,
23 .decls = &.{},24 .decls = &.{},
24 .is_tuple = false,25 .is_tuple = info.is_tuple,
25 }));26 }));
26}27}
2728