Skip to content

Commit 0c44405

Browse files
committed
Clarify read_offset and write_offset documentation
The offset given is relative to the start of the file, independent from the current file cursor.
1 parent fe34c03 commit 0c44405

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libstd/fs.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,24 @@ impl File {
350350
}
351351

352352
/// Reads a number of bytes starting from a given offset.
353+
///
354+
/// The offset is relative to the file start and thus independent from the
355+
/// current cursor.
356+
///
357+
/// Note that similar to `File::read`, it is not an error to return a short
358+
/// read.
353359
#[unstable(feature = "file_offset", issue = "0")]
354360
pub fn read_offset(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
355361
self.inner.read_offset(buf, offset)
356362
}
357363

358364
/// Writes a number of bytes starting from a given offset.
365+
///
366+
/// The offset is relative to the file start and thus independent from the
367+
/// current cursor.
368+
///
369+
/// Note that similar to `File::write`, it is not an error to return a
370+
/// short write.
359371
#[unstable(feature = "file_offset", issue = "0")]
360372
pub fn write_offset(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
361373
self.inner.write_offset(buf, offset)

0 commit comments

Comments
 (0)