Skip to content

Commit

Permalink
Explain EOF behavior in File.eof().
Browse files Browse the repository at this point in the history
Fies #16239.
  • Loading branch information
steveklabnik committed Aug 18, 2014
1 parent 776c17f commit 4a288bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libstd/io/fs.rs
Expand Up @@ -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
}
Expand Down

5 comments on commit 4a288bc

@bors
Copy link
Contributor

@bors bors commented on 4a288bc Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at steveklabnik@4a288bc

@bors
Copy link
Contributor

@bors bors commented on 4a288bc Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging steveklabnik/rust/gh16239 = 4a288bc into auto

@bors
Copy link
Contributor

@bors bors commented on 4a288bc Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

steveklabnik/rust/gh16239 = 4a288bc merged ok, testing candidate = e8ad6a8

@bors
Copy link
Contributor

@bors bors commented on 4a288bc Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = e8ad6a8

Please sign in to comment.