Implement read_exact for the Read trait

This implements the proposed "read_exact" RFC
(https://github.com/rust-lang/rfcs/pull/980).
This commit is contained in:
Cesar Eduardo Barros
2015-07-20 00:23:37 -03:00
parent ef04b07239
commit ff81920f03
4 changed files with 140 additions and 0 deletions

View File

@@ -147,6 +147,15 @@ pub enum ErrorKind {
#[stable(feature = "rust1", since = "1.0.0")]
Other,
/// An error returned when an operation could not be completed because an
/// "end of file" was reached prematurely.
///
/// This typically means that an operation could only succeed if it read a
/// particular number of bytes but only a smaller number of bytes could be
/// read.
#[unstable(feature = "read_exact", reason = "recently added")]
UnexpectedEOF,
/// Any I/O error not part of this list.
#[unstable(feature = "io_error_internals",
reason = "better expressed through extensible enums that this \