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 standard library.
std › Io › Uring › fileReadPositional Private Function fileReadPositional Doc Source Private Function std.Io.Uring.fileReadPositional
fn fileReadPositional (
userdata : ?*anyopaque ,
file : File ,
data : []const []u8 ,
offset : u64 ,
) File .ReadPositionalError !usize Params userdata : ?*anyopaque file : File data : []const []u8 offset : u64 File Io/Uring.zig: 3733
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761 fn fileReadPositional (
userdata : ?*anyopaque ,
file : File ,
data : []const []u8 ,
offset : u64 ,
) File .ReadPositionalError !usize {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
var iovecs_buffer : [max_iovecs_len ]iovec = undefined ;
var i : usize = 0 ;
for (data ) |buf | {
if (iovecs_buffer .len - i == 0 ) break ;
if (buf .len > 0 ) {
iovecs_buffer [i ] = .{ .base = buf .ptr , .len = buf .len };
i += 1 ;
}
}
if (i == 0 ) return 0 ;
const dest = iovecs_buffer [0 ..i ];
assert (dest [0 ].len > 0 );
var cancel_region : CancelRegion = .init ();
defer cancel_region .deinit ();
return ev .preadv (&cancel_region , file .handle , dest , offset ) catch |err | switch (err ) {
error .SocketUnconnected => return errnoBug (.NOTCONN ), // not a socket
error .ConnectionResetByPeer => return errnoBug (.CONNRESET ), // not a socket
else => |e | return e ,
};
}