authorgravatar for awqatty.b@gmail.comBecker A <awqatty.b@gmail.com> 2023-10-06 17:47:19-06:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-10-06 23:47:19+00:00
log5a4a5875dc49dd4e027b17b96dd1348822806e58
tree36abeb02900e19eb08e0b20aecac634c6c130b72
parent41a4908dcc123818315ad26de90fd8d157268484
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Update Server.zig:{listen, do} to specify error enums


1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/http/Server.zig+2-2
...@@ -393,7 +393,7 @@ pub const Response = struct {...@@ -393,7 +393,7 @@ pub const Response = struct {
393 pub const DoError = Connection.WriteError || error{ UnsupportedTransferEncoding, InvalidContentLength };393 pub const DoError = Connection.WriteError || error{ UnsupportedTransferEncoding, InvalidContentLength };
394394
395 /// Send the response headers.395 /// Send the response headers.
396 pub fn do(res: *Response) !void {396 pub fn do(res: *Response) DoError!void {
397 switch (res.state) {397 switch (res.state) {
398 .waited => res.state = .responded,398 .waited => res.state = .responded,
399 .first, .start, .responded, .finished => unreachable,399 .first, .start, .responded, .finished => unreachable,
...@@ -668,7 +668,7 @@ pub fn deinit(server: *Server) void {...@@ -668,7 +668,7 @@ pub fn deinit(server: *Server) void {
668pub const ListenError = std.os.SocketError || std.os.BindError || std.os.ListenError || std.os.SetSockOptError || std.os.GetSockNameError;668pub const ListenError = std.os.SocketError || std.os.BindError || std.os.ListenError || std.os.SetSockOptError || std.os.GetSockNameError;
669669
670/// Start the HTTP server listening on the given address.670/// Start the HTTP server listening on the given address.
671pub fn listen(server: *Server, address: net.Address) !void {671pub fn listen(server: *Server, address: net.Address) ListenError!void {
672 try server.socket.listen(address);672 try server.socket.listen(address);
673}673}
674674