use a bound function for srfFormat
Some checks failed
Generic zig build / build (push) Failing after 36s
Some checks failed
Generic zig build / build (push) Failing after 36s
This commit is contained in:
parent
84b8be4b25
commit
18a4558b47
1 changed files with 3 additions and 2 deletions
|
|
@ -419,7 +419,7 @@ pub const Record = struct {
|
||||||
.@"struct", .@"union" => {
|
.@"struct", .@"union" => {
|
||||||
if (std.meta.hasMethod(field_type, "srfFormat")) {
|
if (std.meta.hasMethod(field_type, "srfFormat")) {
|
||||||
return .{
|
return .{
|
||||||
.value = field_type.srfFormat(self.allocator, field_name) catch |e| {
|
.value = val.srfFormat(self.allocator, field_name) catch |e| {
|
||||||
log.err(
|
log.err(
|
||||||
"custom format of field {s} failed : {}",
|
"custom format of field {s} failed : {}",
|
||||||
.{ field_name, e },
|
.{ field_name, e },
|
||||||
|
|
@ -1166,7 +1166,8 @@ test "serialize/deserialize" {
|
||||||
if (std.mem.eql(u8, "hi", val)) return .{};
|
if (std.mem.eql(u8, "hi", val)) return .{};
|
||||||
return error.ValueNotEqualHi;
|
return error.ValueNotEqualHi;
|
||||||
}
|
}
|
||||||
pub fn srfFormat(allocator: std.mem.Allocator, comptime field_name: []const u8) !Value {
|
pub fn srfFormat(self: Self, allocator: std.mem.Allocator, comptime field_name: []const u8) !Value {
|
||||||
|
_ = self;
|
||||||
_ = field_name;
|
_ = field_name;
|
||||||
return .{
|
return .{
|
||||||
.string = try allocator.dupe(u8, "hi"),
|
.string = try allocator.dupe(u8, "hi"),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue