idx: ?Index = null,
const Self = @This();
+ pub const Key = K;
pub const Index = u64;
pub const View = SetView(K);
pub fn clear(self: *Self) !void {
var it = self.iterator();
while (it.next()) |i| {
- try self.del(i);
+ try self.del(i.key);
}
}
pub fn has(self: Self, k: K) !bool {
idx: ?K,
dir: enum { Forward, Backward },
- pub fn next(self: *Iterator) ?K {
+ pub fn next(self: *Iterator) ?struct { key: K } {
if (self.idx != null) {
const k = self.idx.?;
const item = self.sv.item_get(k) catch return null;
.Forward => item.next,
.Backward => item.prev,
};
- return k;
+ return .{ .key = k };
} else {
return null;
}
const Self = @This();
pub const Index = u64;
+ pub const Key = u64;
+ pub const Val = V;
pub const View = ListView(V);
fn open_dbi(txn: lmdb.Txn) !lmdb.Dbi {
pub fn SetList(comptime K: type, comptime V: type) type {
return struct {
- idx: ?Index = null,
-
const Self = @This();
pub const Index = u64;
+ pub const Key = K;
+ pub const Val = V;
pub const View = SetListView(K, V);
+ idx: ?Index = null,
+
fn open_dbi(txn: lmdb.Txn) !lmdb.Dbi {
return try txn.dbi("SetList");
}