diff options
| author | patrick-scho | 2025-04-11 13:05:32 +0200 |
|---|---|---|
| committer | patrick-scho | 2025-04-11 13:05:32 +0200 |
| commit | 88cb74a430fa9629c8127c3a866c40e79a8e4612 (patch) | |
| tree | 7e339229125d08b62c4ca939253082e5dcc683bb | |
| parent | 9e77f78c0e0ad27b7f9135883e6b666ac20b59fa (diff) | |
| download | ziglmdb-88cb74a430fa9629c8127c3a866c40e79a8e4612.tar.gz ziglmdb-88cb74a430fa9629c8127c3a866c40e79a8e4612.zip | |
update result type to work with zig 0.14.0
| -rw-r--r-- | src/db.zig | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -27,13 +27,14 @@ pub fn Db(comptime K: type, comptime V: type) type { return try self.dbi.has(k); } pub const Iterator = struct { + pub const Result = struct { key: K, val: V }; cursor: lmdb.Cursor, k: ?K, v: ?V, - pub fn next(self: *Iterator) ?struct { key: K, val: V } { + pub fn next(self: *Iterator) ?Result { if (self.k != null and self.v != null) { - const result = .{ .key = self.k.?, .val = self.v.? }; + const result = Result{ .key = self.k.?, .val = self.v.? }; var k = self.k.?; self.v = self.cursor.get(&k, V, .Next) catch return null; @@ -206,13 +207,13 @@ fn SetListViewBase(comptime K: type, comptime V: type) type { return self.dbi.has(self.item_idx(key)); } pub const Iterator = struct { - pub const Result = ?struct { key: K, val: V }; + pub const Result = struct { key: K, val: V }; slv: SetListViewBase(K, V), idx: ?K, dir: enum { Forward, Backward }, - pub fn next(self: *Iterator) Result { + pub fn next(self: *Iterator) ?Result { if (self.idx != null) { const k = self.idx.?; const item = self.slv.item_get(k) catch return null; |
