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
239239 if (comptime extras.isSlice(@TypeOf(x, y))) {
240240 return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y));
241241 }
242 if (@typeInfo(@TypeOf(x)) == .@"struct") {
243 return doif(alloc, writer, body, bottom, data, ctx, opts, x.eql(y));
244 }
242245 try doif(alloc, writer, body, bottom, data, ctx, opts, x == y);
243246 },
244247 .ifnotequal => {
......@@ -250,6 +253,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
250253 if (comptime extras.isSlice(@TypeOf(x, y))) {
251254 return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, x, y));
252255 }
256 if (@typeInfo(@TypeOf(x)) == .@"struct") {
257 return doif(alloc, writer, body, bottom, data, ctx, opts, !x.eql(y));
258 }
253259 try doif(alloc, writer, body, bottom, data, ctx, opts, x != y);
254260 },
255261 }