diff options
-rw-r--r-- | src/io/io_darwin.zig | 34 | ||||
-rw-r--r-- | src/io/io_linux.zig | 10 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/io/io_darwin.zig b/src/io/io_darwin.zig index 97ccd6d23..e57b6710e 100644 --- a/src/io/io_darwin.zig +++ b/src/io/io_darwin.zig @@ -651,6 +651,17 @@ const Operation = union(enum) { event: struct { fd: os.fd_t, }, + nextTick: struct {}, + + pub fn slice(this: Operation) []const u8 { + return switch (this) { + .write => |op| op.buf[0..op.len], + .send => |op| op.buf[0..op.len], + .recv => |op| op.buf[0..op.len], + .read => |op| op.buf[0..op.len], + else => &[_]u8{}, + }; + } }; fn submit( @@ -769,6 +780,29 @@ pub fn event( ); } +pub fn nextTick( + self: *IO, + comptime Context: type, + context: Context, + comptime callback: fn ( + context: Context, + completion: *Completion, + result: void, + ) void, + completion: *Completion, +) void { + self.submit( + context, + callback, + completion, + .nextTick, + .{}, + struct { + fn doOperation(_: anytype) void {} + }, + ); +} + pub fn accept( self: *IO, comptime Context: type, diff --git a/src/io/io_linux.zig b/src/io/io_linux.zig index eeb2352f8..2d8a992fe 100644 --- a/src/io/io_linux.zig +++ b/src/io/io_linux.zig @@ -999,6 +999,16 @@ const Operation = union(enum) { buffer: []const u8, offset: u64, }, + + pub fn slice(this: Operation) []const u8 { + return switch (this) { + .write => |op| op.buffer, + .send => |op| op.buffer, + .recv => |op| op.buffer, + .read => |op| op.buffer, + else => &[_]u8{}, + }; + } }; pub const AcceptError = error{ |