File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 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;
2121/// it was opened with. Files also implement [`Seek`] to alter the logical cursor
2222/// that the file contains internally.
2323///
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.
2527///
2628/// # Examples
2729///
@@ -84,6 +86,7 @@ use crate::time::SystemTime;
8486/// [`Read`]: ../io/trait.Read.html
8587/// [`Write`]: ../io/trait.Write.html
8688/// [`BufReader<R>`]: ../io/struct.BufReader.html
89+ /// [`sync_all`]: struct.File.html#method.sync_all
8790#[ stable( feature = "rust1" , since = "1.0.0" ) ]
8891pub struct File {
8992 inner : fs_imp:: File ,
@@ -391,9 +394,13 @@ impl File {
391394
392395 /// Attempts to sync all OS-internal metadata to disk.
393396 ///
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
395398 /// filesystem before returning.
396399 ///
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+ ///
397404 /// # Examples
398405 ///
399406 /// ```no_run
You can’t perform that action at this time.
0 commit comments