@@ -31,6 +31,10 @@ use crate::time::SystemTime;
31
31
/// on closing are ignored by the implementation of `Drop`. Use the method
32
32
/// [`sync_all`] if these errors must be manually handled.
33
33
///
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
+ ///
34
38
/// # Examples
35
39
///
36
40
/// Creates a new file and write bytes to it (you can also use [`write()`]):
@@ -61,8 +65,7 @@ use crate::time::SystemTime;
61
65
/// }
62
66
/// ```
63
67
///
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:
66
69
///
67
70
/// ```no_run
68
71
/// use std::fs::File;
@@ -93,8 +96,11 @@ use crate::time::SystemTime;
93
96
/// perform synchronous I/O operations. Therefore the underlying file must not
94
97
/// have been opened for asynchronous I/O (e.g. by using `FILE_FLAG_OVERLAPPED`).
95
98
///
96
- /// [`BufReader<R>`]: io::BufReader
99
+ /// [`BufReader`]: io::BufReader
100
+ /// [`BufWriter`]: io::BufReader
97
101
/// [`sync_all`]: File::sync_all
102
+ /// [`write`]: File::write
103
+ /// [`read`]: File::read
98
104
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
99
105
#[ cfg_attr( not( test) , rustc_diagnostic_item = "File" ) ]
100
106
pub struct File {
0 commit comments