authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-15 15:49:24 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-15 15:49:24 -07:00
logb71f336f66b92556620cfcdff696e01c9bd4e205
tree749f96218dd45d50b36e72ae37b6b7064a73c3c8
parent20cd84586cb6f62f15411d47e7e17ef65ef336a3
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

support structs in ifequal and ifnotequal


1 files changed, 6 insertions(+), 0 deletions(-)

src/lib.zig+6
...@@ -239,6 +239,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -239,6 +239,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
239 if (comptime extras.isSlice(@TypeOf(x, y))) {239 if (comptime extras.isSlice(@TypeOf(x, y))) {
240 return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y));240 return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y));
241 }241 }
242 if (@typeInfo(@TypeOf(x)) == .@"struct") {
243 return doif(alloc, writer, body, bottom, data, ctx, opts, x.eql(y));
244 }
242 try doif(alloc, writer, body, bottom, data, ctx, opts, x == y);245 try doif(alloc, writer, body, bottom, data, ctx, opts, x == y);
243 },246 },
244 .ifnotequal => {247 .ifnotequal => {
...@@ -250,6 +253,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -250,6 +253,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
250 if (comptime extras.isSlice(@TypeOf(x, y))) {253 if (comptime extras.isSlice(@TypeOf(x, y))) {
251 return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, x, y));254 return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, x, y));
252 }255 }
256 if (@typeInfo(@TypeOf(x)) == .@"struct") {
257 return doif(alloc, writer, body, bottom, data, ctx, opts, !x.eql(y));
258 }
253 try doif(alloc, writer, body, bottom, data, ctx, opts, x != y);259 try doif(alloc, writer, body, bottom, data, ctx, opts, x != y);
254 },260 },
255 }261 }