Zig bindings for the notmuch C library
0

Configure Feed

Select the types of activity you want to include in your feed.

more zig 0.14.0 updates

Jeffrey C. Ollie (Apr 1, 2025, 8:36 AM -0500) 56d4e7a6 932be49f

+9 -5
+9 -5
src/notmuch.zig
··· 7 7 const log = std.log.scoped(.notmuch); 8 8 9 9 fn generateEnum(comptime prefix: []const u8) type { 10 - @setEvalBranchQuota(9000); 10 + @setEvalBranchQuota(10000); 11 11 const info = @typeInfo(c); 12 12 var count: usize = 0; 13 - for (info.Struct.decls) |d| { 13 + for (info.@"struct".decls) |d| { 14 14 if (std.mem.eql(u8, "NOTMUCH_STATUS_LAST_STATUS", d.name)) continue; 15 15 if (std.mem.startsWith(u8, d.name, prefix)) { 16 16 count += 1; ··· 19 19 var fields: [count]std.builtin.Type.EnumField = undefined; 20 20 var index: usize = 0; 21 21 var max: c.notmuch_status_t = 0; 22 - for (info.Struct.decls) |d| { 22 + for (info.@"struct".decls) |d| { 23 23 if (std.mem.eql(u8, "NOTMUCH_STATUS_LAST_STATUS", d.name)) continue; 24 24 if (std.mem.startsWith(u8, d.name, prefix)) { 25 25 max = @max(max, @field(c, d.name)); ··· 30 30 index += 1; 31 31 } 32 32 } 33 - return @Type(.{ .Enum = .{ 34 - .tag_type = std.meta.Int(.unsigned, std.math.ceilPowerOfTwoAssert(u16, max)), 33 + return @Type(.{ .@"enum" = .{ 34 + .tag_type = std.math.IntFittingRange(0, max), 35 35 .fields = &fields, 36 36 .decls = &.{}, 37 37 .is_exhaustive = true, ··· 168 168 _ = c.notmuch_message_destroy(self.message); 169 169 } 170 170 }; 171 + 172 + test { 173 + std.testing.refAllDeclsRecursive(@This()); 174 + }