Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › Io/ › Dispatch.zig › operate
operate
Dispatch.operate
fn operate (userdata : ?*anyopaque , operation : Io .Operation ) Io .Cancelable !Io .Operation .Result
File
Code
fn operate (userdata : ?*anyopaque , operation : Io .Operation ) Io .Cancelable !Io .Operation .Result {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
switch (operation ) {
.file_read_streaming => |o | return .{
.file_read_streaming = ev .fileReadStreaming (o .file , o .data ) catch |err | switch (err ) {
error .Canceled => |e | return e ,
else => |e | e ,
},
},
.file_write_streaming => |o | return .{
.file_write_streaming = ev .fileWriteStreaming (
o .file ,
o .header ,
o .data ,
o .splat ,
) catch |err | switch (err ) {
error .Canceled => |e | return e ,
else => |e | e ,
},
},
.device_io_control => |*o | return .{ .device_io_control = try deviceIoControl (o ) },
.net_receive => @panic ("TODO implement net_receive operation" ),
.net_read => @panic ("TODO implement net_read operation" ),
}
}