@@ -31,6 +31,10 @@ use crate::time::SystemTime;
3131/// on closing are ignored by the implementation of `Drop`. Use the method
3232/// [`sync_all`] if these errors must be manually handled.
3333///
34+ /// `File` does not buffer reads and writes. For efficiency, consider wrapping the
35+ /// file in a [`BufReader`] or [`BufWriter`] when performing many small [`read`]
36+ /// or [`write`] calls, unless unbuffered reads and writes are required.
37+ ///
3438/// # Examples
3539///
3640/// Creates a new file and write bytes to it (you can also use [`write()`]):
@@ -61,8 +65,7 @@ use crate::time::SystemTime;
6165/// }
6266/// ```
6367///
64- /// It can be more efficient to read the contents of a file with a buffered
65- /// [`Read`]er. This can be accomplished with [`BufReader<R>`]:
68+ /// Using a buffered [`Read`]er:
6669///
6770/// ```no_run
6871/// use std::fs::File;
@@ -93,8 +96,11 @@ use crate::time::SystemTime;
9396/// perform synchronous I/O operations. Therefore the underlying file must not
9497/// have been opened for asynchronous I/O (e.g. by using `FILE_FLAG_OVERLAPPED`).
9598///
96- /// [`BufReader<R>`]: io::BufReader
99+ /// [`BufReader`]: io::BufReader
100+ /// [`BufWriter`]: io::BufReader
97101/// [`sync_all`]: File::sync_all
102+ /// [`write`]: File::write
103+ /// [`read`]: File::read
98104#[ stable( feature = "rust1" , since = "1.0.0" ) ]
99105#[ cfg_attr( not( test) , rustc_diagnostic_item = "File" ) ]
100106pub struct File {
0 commit comments