We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b28ffa commit 9262d64Copy full SHA for 9262d64
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