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.

address4FromPosix

Threaded.address4FromPosix
fn address4FromPosix(in: *const posix.sockaddr.in) net.Ip4Address

File

lib/std/Io/Threaded.zig:14221

Code

fn address4FromPosix(in: *const posix.sockaddr.in) net.Ip4Address {
    // The network byte order address in `in.addr` is already the byte order we want.
    const addr_bytes: *const [4]u8 = @ptrCast(&in.addr);
    return .{
        .port = std.mem.bigToNative(u16, in.port),
        .bytes = addr_bytes.*,
    };
}