We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents da1b296 + 9262d64 commit 78547d2Copy full SHA for 78547d2
src/libstd/fs.rs
@@ -269,14 +269,18 @@ impl File {
269
/// will be extended to `size` and have all of the intermediate data filled
270
/// in with 0s.
271
///
272
+ /// # Errors
273
+ ///
274
+ /// This function will return an error if the file is not opened for writing.
275
276
/// # Examples
277
278
/// ```no_run
279
/// use std::fs::File;
280
281
/// # fn foo() -> std::io::Result<()> {
- /// let mut f = try!(File::open("foo.txt"));
- /// try!(f.set_len(0));
282
+ /// let mut f = try!(File::create("foo.txt"));
283
+ /// try!(f.set_len(10));
284
/// # Ok(())
285
/// # }
286
/// ```
0 commit comments