aboutsummaryrefslogtreecommitdiff
path: root/src/bencode.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/bencode.zig')
-rw-r--r--src/bencode.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bencode.zig b/src/bencode.zig
index d09f394..60a3746 100644
--- a/src/bencode.zig
+++ b/src/bencode.zig
@@ -93,6 +93,13 @@ pub const BValue = union(enum) {
else => return error.WrongType,
}
}
+
+ pub fn asList(self: BValue) !std.ArrayList(BValue) {
+ switch (self) {
+ .list => |l| return l,
+ else => return error.WrongType,
+ }
+ }
};
pub fn bdecodeBuf(a: std.mem.Allocator, buf: []const u8) !BValue {