Skip to content

Commit ccd4689

Browse files
Add missing urls for OpenOptions docs
1 parent 7e5578d commit ccd4689

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/libstd/fs.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,14 +560,20 @@ impl OpenOptions {
560560
///
561561
/// One maybe obvious note when using append-mode: make sure that all data
562562
/// that belongs together is written to the file in one operation. This
563-
/// can be done by concatenating strings before passing them to `write()`,
563+
/// can be done by concatenating strings before passing them to [`write()`],
564564
/// or using a buffered writer (with a buffer of adequate size),
565-
/// and calling `flush()` when the message is complete.
565+
/// and calling [`flush()`] when the message is complete.
566566
///
567567
/// If a file is opened with both read and append access, beware that after
568568
/// opening, and after every write, the position for reading may be set at the
569569
/// end of the file. So, before writing, save the current position (using
570-
/// `seek(SeekFrom::Current(0))`, and restore it before the next read.
570+
/// [`seek`]`(`[`SeekFrom`]`::`[`Current`]`(0))`, and restore it before the next read.
571+
///
572+
/// [`write()`]: ../../std/fs/struct.File.html#method.write
573+
/// [`flush()`]: ../../std/fs/struct.File.html#method.flush
574+
/// [`seek`]: ../../std/fs/struct.File.html#method.seek
575+
/// [`SeekFrom`]: ../../std/io/enum.SeekFrom.html
576+
/// [`Current`]: ../../std/io/enum.SeekFrom.html#variant.Current
571577
///
572578
/// # Examples
573579
///
@@ -605,9 +611,12 @@ impl OpenOptions {
605611
/// This option indicates whether a new file will be created if the file
606612
/// does not yet already exist.
607613
///
608-
/// In order for the file to be created, `write` or `append` access must
614+
/// In order for the file to be created, [`write`] or [`append`] access must
609615
/// be used.
610616
///
617+
/// [`write`]: #method.write
618+
/// [`append`]: #method.append
619+
///
611620
/// # Examples
612621
///
613622
/// ```no_run
@@ -630,12 +639,15 @@ impl OpenOptions {
630639
/// whether a file exists and creating a new one, the file may have been
631640
/// created by another process (a TOCTOU race condition / attack).
632641
///
633-
/// If `.create_new(true)` is set, `.create()` and `.truncate()` are
642+
/// If `.create_new(true)` is set, [`.create()`] and [`.truncate()`] are
634643
/// ignored.
635644
///
636645
/// The file must be opened with write or append access in order to create
637646
/// a new file.
638647
///
648+
/// [`.create()`]: #method.create
649+
/// [`.truncate()`]: #method.truncate
650+
///
639651
/// # Examples
640652
///
641653
/// ```no_run

0 commit comments

Comments
 (0)