diff options
| author | baitcode <batiyiv@gmail.com> | 2024-03-14 18:58:23 +0000 |
|---|---|---|
| committer | baitcode <batiyiv@gmail.com> | 2024-03-14 18:58:23 +0000 |
| commit | 07e0182fd3276bb09081a67dbd6cb69910f14413 (patch) | |
| tree | 105ee2164143f04181190071ac98b10ffdae03b2 /library/std/src | |
| parent | fe6157522848604562f83084154274c545fe3a27 (diff) | |
| download | rust-07e0182fd3276bb09081a67dbd6cb69910f14413.tar.gz rust-07e0182fd3276bb09081a67dbd6cb69910f14413.zip | |
Fix minor documentation issue. Code outside the test would fail. Seek documentation clearly states that negative indexes will cause error.
Just making the code in the example to return Result::Ok, instead of Result::Error.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/io/cursor.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/io/cursor.rs b/library/std/src/io/cursor.rs index 25c64240e74..4ef1f1b695e 100644 --- a/library/std/src/io/cursor.rs +++ b/library/std/src/io/cursor.rs @@ -51,6 +51,8 @@ use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, SeekFrom}; /// // We might want to use a BufReader here for efficiency, but let's /// // keep this example focused. /// let mut file = File::create("foo.txt")?; +/// // First, we need to allocate 10 bytes to be able to write into. +/// file.set_len(10)?; /// /// write_ten_bytes_at_end(&mut file)?; /// # Ok(()) |
