Skip to content

Commit 1e457ad

Browse files
committed
Address review feedback
1 parent 6566a1d commit 1e457ad

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

text/0000-read-all.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ read into, and will attempt to fill that entire slice with data.
2626
It will loop, calling read() once per iteration and attempting to read
2727
the remaining amount of data. If read returns EINTR, the loop will
2828
retry. If there are no more bytes to read (as signalled by a return
29-
of Ok(0) from read()), a new error type, ErrorKind::ShortRead, will be
30-
returned. In the event of another error, that error will be
29+
of Ok(0) from read()), a new error type, ErrorKind::ShortRead(usize),
30+
will be returned. ShortRead includes the number of bytes successfully
31+
read. In the event of another error, that error will be
3132
returned. After a read call returns having successfully read some
32-
bytes, the total number of bytes read will be updated. If that
33-
total is equal to the size of the buffer, read will return
34-
successfully.
33+
bytes, the total number of bytes read will be updated. If that total
34+
is equal to the size of the buffer, read will return successfully.
3535

3636
# Drawbacks
3737

@@ -46,9 +46,9 @@ One alternative design would return some new kind of Result which
4646
could report the number of bytes sucessfully read before an error.
4747
This would be inconsistent with write_all, but arguably more correct.
4848

49-
Another would be that ErrorKind::ShortRead would be parameterized by
50-
the number of bytes read before EOF. The downside of this is that it
51-
bloats the size of io::Error.
49+
If we wanted io::Error to be a smaller type, ErrorKind::ShortRead
50+
could be unparameterized. But this would reduce the information
51+
available to calleres.
5252

5353
Finally, in the event of a short read, we could return Ok(number of
5454
bytes read before EOF) instead of an error. But then every user would

0 commit comments

Comments
 (0)