From 18a4558b47acb3d62701351820cd70dcc2c56c5a Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Wed, 4 Mar 2026 16:42:33 -0800 Subject: [PATCH] use a bound function for srfFormat --- src/srf.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/srf.zig b/src/srf.zig index ea6a6db..5e9ad75 100644 --- a/src/srf.zig +++ b/src/srf.zig @@ -419,7 +419,7 @@ pub const Record = struct { .@"struct", .@"union" => { if (std.meta.hasMethod(field_type, "srfFormat")) { return .{ - .value = field_type.srfFormat(self.allocator, field_name) catch |e| { + .value = val.srfFormat(self.allocator, field_name) catch |e| { log.err( "custom format of field {s} failed : {}", .{ field_name, e }, @@ -1166,7 +1166,8 @@ test "serialize/deserialize" { if (std.mem.eql(u8, "hi", val)) return .{}; 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; return .{ .string = try allocator.dupe(u8, "hi"),