Skip to content

Commit 3e9d5fe

Browse files
Adjusted heading and created dedicated section in std::io docs
1 parent 66e842b commit 3e9d5fe

File tree

2 files changed

+39
-30
lines changed

2 files changed

+39
-30
lines changed

src/libstd/fs.rs

+30-30
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ impl DirEntry {
715715
/// This function will not traverse symlinks if this entry points at a
716716
/// symlink.
717717
///
718-
/// # Platform behavior
718+
/// # Platform-specific behavior
719719
///
720720
/// On Windows this function is cheap to call (no extra system calls
721721
/// needed), but on Unix platforms this function is the equivalent of
@@ -730,7 +730,7 @@ impl DirEntry {
730730
/// This function will not traverse symlinks if this entry points at a
731731
/// symlink.
732732
///
733-
/// # Platform behavior
733+
/// # Platform-specific behavior
734734
///
735735
/// On Windows and most Unix platforms this function is free (no extra
736736
/// system calls needed), but some Unix platforms may require the equivalent
@@ -758,12 +758,12 @@ impl AsInner<fs_imp::DirEntry> for DirEntry {
758758
/// guarantee that the file is immediately deleted (e.g. depending on
759759
/// platform, other open file descriptors may prevent immediate removal).
760760
///
761-
/// # Platform behavior
761+
/// # Platform-specific behavior
762762
///
763763
/// This function currently corresponds to the `unlink` function on Unix
764764
/// and the `DeleteFile` function on Windows.
765765
/// Note that, this [may change in the future][changes].
766-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
766+
/// [changes]: ../io/index.html#platform-specific-behavior
767767
///
768768
/// # Errors
769769
///
@@ -794,12 +794,12 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
794794
/// This function will traverse symbolic links to query information about the
795795
/// destination file.
796796
///
797-
/// # Platform behavior
797+
/// # Platform-specific behavior
798798
///
799799
/// This function currently corresponds to the `stat` function on Unix
800800
/// and the `GetFileAttributesEx` function on Windows.
801801
/// Note that, this [may change in the future][changes].
802-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
802+
/// [changes]: ../io/index.html#platform-specific-behavior
803803
///
804804
/// # Errors
805805
///
@@ -827,12 +827,12 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
827827

828828
/// Query the metadata about a file without following symlinks.
829829
///
830-
/// # Platform behavior
830+
/// # Platform-specific behavior
831831
///
832832
/// This function currently corresponds to the `lstat` function on Unix
833833
/// and the `GetFileAttributesEx` function on Windows.
834834
/// Note that, this [may change in the future][changes].
835-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
835+
/// [changes]: ../io/index.html#platform-specific-behavior
836836
///
837837
/// # Errors
838838
///
@@ -862,12 +862,12 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
862862
///
863863
/// This will not work if the new name is on a different mount point.
864864
///
865-
/// # Platform behavior
865+
/// # Platform-specific behavior
866866
///
867867
/// This function currently corresponds to the `rename` function on Unix
868868
/// and the `MoveFileEx` function with the `MOVEFILE_REPLACE_EXISTING` flag on Windows.
869869
/// Note that, this [may change in the future][changes].
870-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
870+
/// [changes]: ../io/index.html#platform-specific-behavior
871871
///
872872
/// # Errors
873873
///
@@ -903,14 +903,14 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
903903
///
904904
/// On success, the total number of bytes copied is returned.
905905
///
906-
/// # Platform behavior
906+
/// # Platform-specific behavior
907907
///
908908
/// This function currently corresponds to the `open` function in Unix
909909
/// with `O_RDONLY` for `from` and `O_WRONLY`, `O_CREAT`, and `O_TRUNC` for `to`.
910910
/// `O_CLOEXEC` is set for returned file descriptors.
911911
/// On Windows, this function currently corresponds to `CopyFileEx`.
912912
/// Note that, this [may change in the future][changes].
913-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
913+
/// [changes]: ../io/index.html#platform-specific-behavior
914914
///
915915
/// # Errors
916916
///
@@ -941,12 +941,12 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
941941
/// The `dst` path will be a link pointing to the `src` path. Note that systems
942942
/// often require these two paths to both be located on the same filesystem.
943943
///
944-
/// # Platform behavior
944+
/// # Platform-specific behavior
945945
///
946946
/// This function currently corresponds to the `link` function on Unix
947947
/// and the `CreateHardLink` function on Windows.
948948
/// Note that, this [may change in the future][changes].
949-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
949+
/// [changes]: ../io/index.html#platform-specific-behavior
950950
///
951951
/// # Errors
952952
///
@@ -998,13 +998,13 @@ pub fn soft_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<(
998998

999999
/// Reads a symbolic link, returning the file that the link points to.
10001000
///
1001-
/// # Platform behavior
1001+
/// # Platform-specific behavior
10021002
///
10031003
/// This function currently corresponds to the `readlink` function on Unix
10041004
/// and the `CreateFile` function with `FILE_FLAG_OPEN_REPARSE_POINT` and
10051005
/// `FILE_FLAG_BACKUP_SEMANTICS` flags on Windows.
10061006
/// Note that, this [may change in the future][changes].
1007-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1007+
/// [changes]: ../io/index.html#platform-specific-behavior
10081008
///
10091009
/// # Errors
10101010
///
@@ -1032,12 +1032,12 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
10321032
/// Returns the canonical form of a path with all intermediate components
10331033
/// normalized and symbolic links resolved.
10341034
///
1035-
/// # Platform behavior
1035+
/// # Platform-specific behavior
10361036
///
10371037
/// This function currently corresponds to the `realpath` function on Unix
10381038
/// and the `CreateFile` and `GetFinalPathNameByHandle` functions on Windows.
10391039
/// Note that, this [may change in the future][changes].
1040-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1040+
/// [changes]: ../io/index.html#platform-specific-behavior
10411041
///
10421042
/// # Errors
10431043
///
@@ -1064,12 +1064,12 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
10641064

10651065
/// Creates a new, empty directory at the provided path
10661066
///
1067-
/// # Platform behavior
1067+
/// # Platform-specific behavior
10681068
///
10691069
/// This function currently corresponds to the `mkdir` function on Unix
10701070
/// and the `CreateDirectory` function on Windows.
10711071
/// Note that, this [may change in the future][changes].
1072-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1072+
/// [changes]: ../io/index.html#platform-specific-behavior
10731073
///
10741074
/// # Errors
10751075
///
@@ -1097,12 +1097,12 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
10971097
/// Recursively create a directory and all of its parent components if they
10981098
/// are missing.
10991099
///
1100-
/// # Platform behavior
1100+
/// # Platform-specific behavior
11011101
///
11021102
/// This function currently corresponds to the `mkdir` function on Unix
11031103
/// and the `CreateDirectory` function on Windows.
11041104
/// Note that, this [may change in the future][changes].
1105-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1105+
/// [changes]: ../io/index.html#platform-specific-behavior
11061106
///
11071107
/// # Errors
11081108
///
@@ -1131,12 +1131,12 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
11311131

11321132
/// Removes an existing, empty directory.
11331133
///
1134-
/// # Platform behavior
1134+
/// # Platform-specific behavior
11351135
///
11361136
/// This function currently corresponds to the `rmdir` function on Unix
11371137
/// and the `RemoveDirectory` function on Windows.
11381138
/// Note that, this [may change in the future][changes].
1139-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1139+
/// [changes]: ../io/index.html#platform-specific-behavior
11401140
///
11411141
/// # Errors
11421142
///
@@ -1167,13 +1167,13 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
11671167
/// This function does **not** follow symbolic links and it will simply remove the
11681168
/// symbolic link itself.
11691169
///
1170-
/// # Platform behavior
1170+
/// # Platform-specific behavior
11711171
///
11721172
/// This function currently corresponds to `opendir`, `lstat`, `rm` and `rmdir` functions on Unix
11731173
/// and the `FindFirstFile`, `GetFileAttributesEx`, `DeleteFile`, and `RemoveDirectory` functions
11741174
/// on Windows.
11751175
/// Note that, this [may change in the future][changes].
1176-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1176+
/// [changes]: ../io/index.html#platform-specific-behavior
11771177
///
11781178
/// # Errors
11791179
///
@@ -1212,12 +1212,12 @@ fn _remove_dir_all(path: &Path) -> io::Result<()> {
12121212
/// The iterator will yield instances of `io::Result<DirEntry>`. New errors may
12131213
/// be encountered after an iterator is initially constructed.
12141214
///
1215-
/// # Platform behavior
1215+
/// # Platform-specific behavior
12161216
///
12171217
/// This function currently corresponds to the `opendir` function on Unix
12181218
/// and the `FindFirstFile` function on Windows.
12191219
/// Note that, this [may change in the future][changes].
1220-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1220+
/// [changes]: ../io/index.html#platform-specific-behavior
12211221
///
12221222
/// # Errors
12231223
///
@@ -1315,12 +1315,12 @@ impl Iterator for WalkDir {
13151315

13161316
/// Changes the permissions found on a file or a directory.
13171317
///
1318-
/// # Platform behavior
1318+
/// # Platform-specific behavior
13191319
///
13201320
/// This function currently corresponds to the `chmod` function on Unix
13211321
/// and the `SetFileAttributes` function on Windows.
13221322
/// Note that, this [may change in the future][changes].
1323-
/// [changes]: https://github.com/rust-lang/rust/pull/28613
1323+
/// [changes]: ../io/index.html#platform-specific-behavior
13241324
///
13251325
/// # Errors
13261326
///

src/libstd/io/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@
238238
//!
239239
//! [result]: type.Result.html
240240
//! [try]: ../macro.try!.html
241+
//!
242+
//! ## Platform-specific behavior
243+
//!
244+
//! Many I/O functions throughout the standard library are documented to indicate
245+
//! what various library or syscalls they are delegated to. This is done to help
246+
//! applications both understand what's happening under the hood as well as investigate
247+
//! any possibly unclear semantics. Note, however, that this is informative, not a binding
248+
//! contract. The implementation of many of these functions are subject to change over
249+
//! time and may call fewer or more syscalls/library functions.
241250
242251
#![stable(feature = "rust1", since = "1.0.0")]
243252

0 commit comments

Comments
 (0)