| ... | ... | @@ -27,14 +27,16 @@ pub fn read(self: File, buffer: []u8) ReadError!usize { |
| 27 | 27 | |
| 28 | 28 | pub fn anyReadable(self: File) nio.AnyReadable { |
| 29 | 29 | const S = struct { |
| 30 | | fn foo(s: *allowzero anyopaque, buffer: []u8) anyerror!usize { |
| 30 | fn read(s: *allowzero anyopaque, buffer: []u8) anyerror!usize { |
| 31 | 31 | const fd: nfs.Handle = @enumFromInt(@intFromPtr(s)); |
| 32 | 32 | const f: File = .{ .fd = fd }; |
| 33 | 33 | return f.read(buffer); |
| 34 | 34 | } |
| 35 | 35 | }; |
| 36 | 36 | return .{ |
| 37 | | .readFn = S.foo, |
| 37 | .vtable = &.{ |
| 38 | .read = S.read, |
| 39 | }, |
| 38 | 40 | .state = @ptrFromInt(@as(usize, @bitCast(@as(isize, @intCast(@intFromEnum(self.fd)))))), |
| 39 | 41 | }; |
| 40 | 42 | } |