treesummaryrefslogcommitdiff
path: root/src
diff options
context:
space:
mode:
authorpatrick-scho2025-04-11 13:05:32 +0200
committerpatrick-scho2025-04-11 13:05:32 +0200
commit88cb74a430fa9629c8127c3a866c40e79a8e4612 (patch)
tree7e339229125d08b62c4ca939253082e5dcc683bb /src
parent9e77f78c0e0ad27b7f9135883e6b666ac20b59fa (diff)
downloadziglmdb-88cb74a430fa9629c8127c3a866c40e79a8e4612.tar.gz
ziglmdb-88cb74a430fa9629c8127c3a866c40e79a8e4612.zip
update result type to work with zig 0.14.0
Diffstat (limited to 'src')
-rw-r--r--src/db.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/db.zig b/src/db.zig
index 4062ba9..71b5272 100644
--- a/src/db.zig
+++ b/src/db.zig
@@ -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;