diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2014-08-18 13:17:27 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2014-08-18 15:28:27 -0400 |
| commit | 4a288bc4b7025bef6a12c7e0cd196eb8371e2753 (patch) | |
| tree | 4b9b284921eedb2f9798795eec8e014019d4a7fe /src/libstd | |
| parent | 776c17f476c4be92f6cfe4dab528886973ea8c03 (diff) | |
| download | rust-4a288bc4b7025bef6a12c7e0cd196eb8371e2753.tar.gz rust-4a288bc4b7025bef6a12c7e0cd196eb8371e2753.zip | |
Explain EOF behavior in File.eof().
Fies #16239.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/fs.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index f95f41509a0..725d3b10def 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -236,10 +236,15 @@ impl File { }) } - /// Tests whether this stream has reached EOF. + /// Returns true if the stream has reached the end of the file. /// /// If true, then this file will no longer continue to return data via /// `read`. + /// + /// Note that the operating system will not return an `EOF` indicator + /// until you have attempted to read past the end of the file, so if + /// you've read _exactly_ the number of bytes in the file, this will + /// return `false`, not `true`. pub fn eof(&self) -> bool { self.last_nread == 0 } |
