diff --git a/lib/std/fs/File.zig b/lib/std/fs/File.zig index 394ec7a291f22ade84435b901b6c70168eff9fb5..969c35e6b1825d161e563d61f2554c834bd3c5ba 100644 --- a/lib/std/fs/File.zig +++ b/lib/std/fs/File.zig @@ -1122,10 +1122,15 @@ pub const Reader = struct { /// position, use `logicalPos`. pos: u64 = 0, size: ?u64 = null, - size_err: ?GetEndPosError = null, + size_err: ?SizeError = null, seek_err: ?Reader.SeekError = null, interface: std.Io.Reader, + pub const SizeError = std.os.windows.GetFileSizeError || StatError || error{ + /// Occurs if, for example, the file handle is a network socket and therefore does not have a size. + Streaming, + }; + pub const SeekError = File.SeekError || error{ /// Seeking fell back to reading, and reached the end before the requested seek position. /// `pos` remains at the end of the file. diff --git a/lib/std/net.zig b/lib/std/net.zig index 45abc42568b96d29818c73ec6a7f4e725aa261c7..0e0bae3c0370854bea5978b9ccc650963e4898f9 100644 --- a/lib/std/net.zig +++ b/lib/std/net.zig @@ -2064,6 +2064,7 @@ pub const Stream = struct { .file = .{ .handle = net_stream.handle }, .mode = .streaming, .seek_err = error.Unseekable, + .size_err = error.Streaming, }, }; }