buffered_read: return empty buffer on eof

This commit is contained in:
Dietmar Maurer
2019-01-06 09:17:28 +01:00
parent 0a72e26704
commit 318564ac03
2 changed files with 5 additions and 2 deletions

View File

@ -21,8 +21,9 @@ pub mod timer;
/// `buffered_read`. It returns a reference to an internal buffer. The
/// purpose of this traid is to avoid unnecessary data copies.
pub trait BufferedReader {
/// This functions tries to fill the internal buffers, then returns
/// a reference to the available data.
/// This functions tries to fill the internal buffers, then
/// returns a reference to the available data. It returns an empty
/// buffer if `offset` points to the end of the file.
fn buffered_read(&mut self, offset: u64) -> Result<&[u8], Error>;
}