diff --git a/src/bincode/bincode.zig b/src/bincode/bincode.zig index 64cfb5b21..aaf7792dc 100644 --- a/src/bincode/bincode.zig +++ b/src/bincode/bincode.zig @@ -674,18 +674,6 @@ pub fn HashMapConfig(comptime hm_info: sig.utils.types.HashMapInfo) type { }; } -pub fn alwaysSkip(_: anytype) bool { - return true; -} - -pub fn neverSkip(_: anytype) bool { - return false; -} - -pub fn skipIfNull(data: anytype) bool { - return data == null; -} - pub fn getConfig(comptime struct_type: type) ?FieldConfig(struct_type) { const bincode_field = "!bincode-config"; if (@hasDecl(struct_type, bincode_field)) { diff --git a/src/bincode/int.zig b/src/bincode/int.zig index 2302fb54d..b50990db9 100644 --- a/src/bincode/int.zig +++ b/src/bincode/int.zig @@ -3,7 +3,7 @@ const sig = @import("../lib.zig"); const bincode = sig.bincode; pub fn defaultOnEof(comptime T: type, comptime eof_value: T) bincode.FieldConfig(T) { - const gen = struct { + const S = struct { fn deserializer( _: std.mem.Allocator, reader: anytype, @@ -26,7 +26,7 @@ pub fn defaultOnEof(comptime T: type, comptime eof_value: T) bincode.FieldConfig } }; return .{ - .deserializer = gen.deserializer, - .serializer = gen.serializer, + .deserializer = S.deserializer, + .serializer = S.serializer, }; } diff --git a/src/bincode/list.zig b/src/bincode/list.zig index 74546194f..6cc968404 100644 --- a/src/bincode/list.zig +++ b/src/bincode/list.zig @@ -7,7 +7,7 @@ pub fn valueEncodedAsSlice( comptime T: type, comptime config: bincode.FieldConfig(T), ) bincode.FieldConfig(T) { - const gen = struct { + const S = struct { fn deserializeImpl( allocator: std.mem.Allocator, reader: anytype, @@ -34,8 +34,8 @@ pub fn valueEncodedAsSlice( } }; return .{ - .deserializer = gen.deserializeImpl, - .serializer = gen.serializeImpl, + .deserializer = S.deserializeImpl, + .serializer = S.serializeImpl, .free = config.free, .skip = config.skip, .hashmap = config.hashmap, diff --git a/src/bincode/optional.zig b/src/bincode/optional.zig index 4fc13dfef..4f0f7e144 100644 --- a/src/bincode/optional.zig +++ b/src/bincode/optional.zig @@ -14,7 +14,7 @@ pub fn defaultToNullOnEof( hashmap: if (hashMapInfo(T)) |hm_info| bincode.HashMapConfig(hm_info) else void = if (hashMapInfo(T) != null) .{} else {}, }, ) bincode.FieldConfig(?T) { - const gen = struct { + const S = struct { fn deserializer( allocator: std.mem.Allocator, reader: anytype, @@ -41,8 +41,8 @@ pub fn defaultToNullOnEof( } }; return .{ - .deserializer = gen.deserializer, - .serializer = gen.serializer, + .deserializer = S.deserializer, + .serializer = S.serializer, .free = options.free, .skip = false, .hashmap = options.hashmap,