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 › net › HostName › enqueueConnection Private Function enqueueConnection Doc Source Private Function std.Io.net.HostName.enqueueConnection
fn enqueueConnection (
address : IpAddress ,
io : Io ,
queue : *Io .Queue (IpAddress .ConnectError !Stream ),
options : IpAddress .ConnectOptions ,
) Io .Cancelable !void Params File Io/net/HostName.zig: 390
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405 fn enqueueConnection (
address : IpAddress ,
io : Io ,
queue : *Io .Queue (IpAddress .ConnectError !Stream ),
options : IpAddress .ConnectOptions ,
) Io .Cancelable !void {
const result = address .connect (io , options ) catch |err | switch (err ) {
error .Canceled => |e | return e ,
else => |e | e , // other errors go in the result queue
};
errdefer if (result ) |s | s .close (io ) else |_ | {};
queue .putOne (io , result ) catch |err | switch (err ) {
error .Canceled => |e | return e ,
error .Closed => unreachable , // `queue` must not be closed
};
}