diff options
author | Martin Ashby <martin@ashbysoft.com> | 2023-11-11 11:36:26 +0000 |
---|---|---|
committer | Martin Ashby <martin@ashbysoft.com> | 2023-11-11 11:36:26 +0000 |
commit | dff4234bf2d957a0328ff4f3dc4f9bba1fbeffd4 (patch) | |
tree | aee908b8552c203b754ba9c62c40262dc0cdef09 /src/bencode.zig | |
parent | 7eff166e1f7b440392be1082e3edd0c38b92d77c (diff) | |
download | zbt-dff4234bf2d957a0328ff4f3dc4f9bba1fbeffd4.tar.gz zbt-dff4234bf2d957a0328ff4f3dc4f9bba1fbeffd4.tar.bz2 zbt-dff4234bf2d957a0328ff4f3dc4f9bba1fbeffd4.tar.xz zbt-dff4234bf2d957a0328ff4f3dc4f9bba1fbeffd4.zip |
Extend meta info file parsing
Diffstat (limited to 'src/bencode.zig')
-rw-r--r-- | src/bencode.zig | 7 |
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 { |