@@ -465,14 +465,20 @@ impl File {
465465 OpenOptions :: new ( )
466466 }
467467
468- /// Attempts to sync all OS-internal metadata to disk.
468+ /// Attempts to sync all OS-internal file content and metadata to disk.
469469 ///
470470 /// This function will attempt to ensure that all in-memory data reaches the
471471 /// filesystem before returning.
472472 ///
473473 /// This can be used to handle errors that would otherwise only be caught
474- /// when the `File` is closed. Dropping a file will ignore errors in
475- /// synchronizing this in-memory data.
474+ /// when the `File` is closed, as dropping a `File` will ignore all errors.
475+ /// Note, however, that `sync_all` is generally more expensive than closing
476+ /// a file by dropping it, because the latter is not required to block until
477+ /// the data has been written to the filesystem.
478+ ///
479+ /// If synchronizing the metadata is not required, use [`sync_data`] instead.
480+ ///
481+ /// [`sync_data`]: File::sync_data
476482 ///
477483 /// # Examples
478484 ///
@@ -489,6 +495,7 @@ impl File {
489495 /// }
490496 /// ```
491497 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
498+ #[ doc( alias = "fsync" ) ]
492499 pub fn sync_all ( & self ) -> io:: Result < ( ) > {
493500 self . inner . fsync ( )
494501 }
@@ -520,6 +527,7 @@ impl File {
520527 /// }
521528 /// ```
522529 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
530+ #[ doc( alias = "fdatasync" ) ]
523531 pub fn sync_data ( & self ) -> io:: Result < ( ) > {
524532 self . inner . datasync ( )
525533 }
0 commit comments