std.io: fix compile error when InStream has empty error set

This commit is contained in:
Andrew Kelley 2018-10-16 12:48:38 -04:00
parent 49bc33efe1
commit eeb4f376a3
No known key found for this signature in database
GPG Key ID: 4E7CD66038A4D47C

View File

@ -114,14 +114,14 @@ pub fn InStream(comptime ReadError: type) type {
/// Returns the number of bytes read. It may be less than buffer.len.
/// If the number of bytes read is 0, it means end of stream.
/// End of stream is not an error condition.
pub fn read(self: *Self, buffer: []u8) !usize {
pub fn read(self: *Self, buffer: []u8) Error!usize {
return self.readFn(self, buffer);
}
/// Returns the number of bytes read. If the number read is smaller than buf.len, it
/// means the stream reached the end. Reaching the end of a stream is not an error
/// condition.
pub fn readFull(self: *Self, buffer: []u8) !usize {
pub fn readFull(self: *Self, buffer: []u8) Error!usize {
var index: usize = 0;
while (index != buffer.len) {
const amt = try self.read(buffer[index..]);