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 › Threaded › LookupDnsWindows › completedFallible Private Function completedFallible Doc Source Private Function std.Io.Threaded.LookupDnsWindows.completedFallible
fn completedFallible (lookup_dns : *LookupDnsWindows ) (Io .QueueClosedError || Io .Cancelable )!void Params File Io/Threaded.zig: 14996
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029 fn completedFallible (lookup_dns : *LookupDnsWindows ) (Io .QueueClosedError || Io .Cancelable )!void {
assert (!lookup_dns .done );
const t = lookup_dns .threaded ;
defer t .dl .DnsFree .raw .?(lookup_dns .results .pQueryRecords , .RecordList );
if (lookup_dns .results .QueryStatus != .SUCCESS ) return ;
const t_io = t .io ();
var record_it = lookup_dns .results .pQueryRecords ;
while (record_it ) |record | : (record_it = record .pNext ) switch (record .wType ) {
else => {},
.A => try lookup_dns .resolved .putOne (t_io , .{
.address = .{ .ip4 = .{ .bytes = record .Data .A , .port = lookup_dns .options .port } },
}),
.AAAA => {
const ip6 : net .Ip6Address = .{
.bytes = record .Data .AAAA ,
.port = lookup_dns .options .port ,
};
try lookup_dns .resolved .putOne (t_io , .{
.address = if (lookup_dns .options .family ) |_ | .{ .ip6 = ip6 } else .fromIp6 (ip6 ),
});
},
};
if (lookup_dns .results .pQueryRecords ) |record | {
if (lookup_dns .options .canonical_name_buffer ) |buf | {
const name_wtf16 = std .mem .span (
@as ([*:0 ]const windows .WCHAR , @ptrCast (@alignCast (record .pName ))),
);
const len = std .unicode .wtf16LeToWtf8 (buf , name_wtf16 );
try lookup_dns .resolved .putOne (t_io , .{
.canonical_name = .{ .bytes = buf [0 ..len ] },
});
}
}
}