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 › http › Client › connectUnix Public Function connectUnix Doc Source Public Function std.http.Client.connectUnix
pub fn connectUnix (client : *Client , path : []const u8 ) ConnectUnixError !*Connection Params client : *Client path : []const u8 File http/Client.zig: 1490
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520 pub fn connectUnix (client : *Client , path : []const u8 ) ConnectUnixError !*Connection {
const io = client .io ;
if (try client .connection_pool .findConnection (io , .{
.host = path ,
.port = 0 ,
.protocol = .plain ,
})) |node |
return node ;
const conn = try client .allocator .create (ConnectionPool .Node );
errdefer client .allocator .destroy (conn );
conn .* = .{ .data = undefined };
const stream = try Io .net .connectUnixSocket (path );
errdefer stream .close (io );
conn .data = .{
.stream = stream ,
.tls_client = undefined ,
.protocol = .plain ,
.host = try client .allocator .dupe (u8 , path ),
.port = 0 ,
};
errdefer client .allocator .free (conn .data .host );
try client .connection_pool .addUsed (conn );
return &conn .data ;
}
Connect to
pathas a unix domain socket. This will reuse a connection if one is already open.This function is threadsafe.