File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ use crate::time::SystemTime;
21
21
/// it was opened with. Files also implement [`Seek`] to alter the logical cursor
22
22
/// that the file contains internally.
23
23
///
24
- /// Files are automatically closed when they go out of scope.
24
+ /// Files are automatically closed when they go out of scope. Errors detected
25
+ /// on closing are ignored by the implementation of `Drop`. Use the method
26
+ /// [`sync_all`] if these errors must be manually handled.
25
27
///
26
28
/// # Examples
27
29
///
@@ -84,6 +86,7 @@ use crate::time::SystemTime;
84
86
/// [`Read`]: ../io/trait.Read.html
85
87
/// [`Write`]: ../io/trait.Write.html
86
88
/// [`BufReader<R>`]: ../io/struct.BufReader.html
89
+ /// [`sync_all`]: struct.File.html#method.sync_all
87
90
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
88
91
pub struct File {
89
92
inner : fs_imp:: File ,
@@ -391,9 +394,13 @@ impl File {
391
394
392
395
/// Attempts to sync all OS-internal metadata to disk.
393
396
///
394
- /// This function will attempt to ensure that all in-core data reaches the
397
+ /// This function will attempt to ensure that all in-memory data reaches the
395
398
/// filesystem before returning.
396
399
///
400
+ /// This can be used to handle errors that would otherwise only be caught
401
+ /// when the `File` is closed. Dropping a file will ignore errors in
402
+ /// synchronizing this in-memory data.
403
+ ///
397
404
/// # Examples
398
405
///
399
406
/// ```no_run
You can’t perform that action at this time.
0 commit comments