authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-08-28 12:04:31 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-08-28 12:04:31 -07:00
log874ae5c71c029969d4aef1aaea77b6dcbf913289
tree0d81bd930e00c519238ff67e8606ddfab9567b3e
parent19b34143608a825b6d950035c5264f99298cdb19

AnyReadable: move readFn to vtable


1 files changed, 4 insertions(+), 2 deletions(-)

File.zig+4-2
......@@ -27,14 +27,16 @@ pub fn read(self: File, buffer: []u8) ReadError!usize {
2727
2828pub fn anyReadable(self: File) nio.AnyReadable {
2929 const S = struct {
30 fn foo(s: *allowzero anyopaque, buffer: []u8) anyerror!usize {
30 fn read(s: *allowzero anyopaque, buffer: []u8) anyerror!usize {
3131 const fd: nfs.Handle = @enumFromInt(@intFromPtr(s));
3232 const f: File = .{ .fd = fd };
3333 return f.read(buffer);
3434 }
3535 };
3636 return .{
37 .readFn = S.foo,
37 .vtable = &.{
38 .read = S.read,
39 },
3840 .state = @ptrFromInt(@as(usize, @bitCast(@as(isize, @intCast(@intFromEnum(self.fd)))))),
3941 };
4042}