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.

address4ToPosix

Threaded.address4ToPosix
fn address4ToPosix(a: net.Ip4Address) posix.sockaddr.in

File

lib/std/Io/Threaded.zig:14239

Code

fn address4ToPosix(a: net.Ip4Address) posix.sockaddr.in {
    // The byte order of `a.bytes` is already equivalent to a network byte order address.
    const addr_raw: *align(1) const u32 = @ptrCast(&a.bytes);
    return .{
        .port = std.mem.nativeToBig(u16, a.port),
        .addr = addr_raw.*,
    };
}