Function format [src]
Prototype
pub fn format( self: Address, comptime fmt: []const u8, options: std.fmt.FormatOptions, out_stream: anytype, ) !void
Parameters
self: Address
fmt: []const u8
options: std.fmt.FormatOptions
Source
pub fn format(
self: Address,
comptime fmt: []const u8,
options: std.fmt.FormatOptions,
out_stream: anytype,
) !void {
if (fmt.len != 0) std.fmt.invalidFmtError(fmt, self);
switch (self.any.family) {
posix.AF.INET => try self.in.format(fmt, options, out_stream),
posix.AF.INET6 => try self.in6.format(fmt, options, out_stream),
posix.AF.UNIX => {
if (!has_unix_sockets) {
unreachable;
}
try std.fmt.format(out_stream, "{s}", .{std.mem.sliceTo(&self.un.path, 0)});
},
else => unreachable,
}
}