Skip to content

Commit

Permalink
Delete dead code, rename local gens to Ss
Browse files Browse the repository at this point in the history
  • Loading branch information
InKryption committed Jul 12, 2024
1 parent bbdf028 commit 2b2d2c6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
12 changes: 0 additions & 12 deletions src/bincode/bincode.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions src/bincode/int.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
};
}
6 changes: 3 additions & 3 deletions src/bincode/list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/bincode/optional.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 2b2d2c6

Please sign in to comment.