~alva/zig-bare

e881336eb2995b8a2d25220de38afaedaa564a63 — Alva 4 months ago 3c52ade
Try to support future Zig version[s]
1 files changed, 12 insertions(+), 4 deletions(-)

M src/bare.zig
M src/bare.zig => src/bare.zig +12 -4
@@ 327,11 327,19 @@ pub const Writer = struct {
            @compileError("unsupported hashmap key type");

        try self.writeVarUint(value.size, stream);
        var it = value.iterator();

        while (it.next()) |kv| {
            try self.write(kv.key, stream);
            try self.write(kv.value, stream);
        if (@hasDecl(T, "items")) {
            for (value.items()) |entry| {
                try self.write(entry.key, stream);
                try self.write(entry.value, stream);
            }
        } else {
            var it = value.iterator();

            while (it.next()) |kv| {
                try self.write(kv.key, stream);
                try self.write(kv.value, stream);
            }
        }
    }