Skip to content

Commit 0cea7fe

Browse files
Improve documentation
1 parent 493a05e commit 0cea7fe

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
//! and then replacing the destination file with the temporary file once the new contents are fully
8181
//! written to the filesystem.
8282
//!
83-
//! On Unix, the implementation is roughly equivalent to this pseudocode:
83+
//! On **Unix**, the implementation is roughly equivalent to this pseudocode:
8484
//!
8585
//! ```text
8686
//! fd = open("/path/to/directory/.filename.XXXXXX", O_WRONLY | O_CLOEXEC);
@@ -89,16 +89,17 @@
8989
//! rename("/path/to/directory/.filename.XXXXXX", "/path/to/directory/filename");
9090
//! ```
9191
//!
92-
//! Where `XXXXXX` represents a random suffix. On other non-Unix platforms, the implementation is
92+
//! Where `XXXXXX` represents a random suffix. On **non-Unix** platforms, the implementation is
9393
//! similar and uses the equivalent platform-specific system calls.
9494
//!
95-
//! On Unix, the actual implementation is more robust and makes use of directory file descriptors
96-
//! (and the system calls `openat`, `linkat`, `renameat`) to make sure that, if the directory is
97-
//! renamed or remounted during the operations, the file still ends up in the original destination
98-
//! directory, and no cross-device writes happen.
95+
//! On **Unix**, the actual implementation is more robust and makes use of directory file
96+
//! descriptors (and the system calls `openat`, `linkat`, `renameat`) to make sure that, if the
97+
//! directory is renamed or remounted during the operations, the file still ends up in the original
98+
//! destination directory, and no cross-device writes happen.
9999
//!
100-
//! On Linux, the implementation makes use of anonymous temporary files (opened with `O_TMPFILE`),
101-
//! and the implementation is roughly equivalent to this pseudocode:
100+
//! On **Linux**, the implementation makes use of anonymous temporary files (opened with
101+
//! [`O_TMPFILE`](https://www.man7.org/linux/man-pages/man2/open.2.html)) if supported, and the
102+
//! implementation is roughly equivalent to this pseudocode:
102103
//!
103104
//! ```text
104105
//! fd = open("/path/to/directory", O_TMPFILE | O_WRONLY | O_CLOEXEC);
@@ -108,7 +109,7 @@
108109
//! rename("/path/to/directory/.filename.XXXXXX", "/path/to/directory/filename");
109110
//! ```
110111
//!
111-
//! This Linux-specific behavior is controlled by the `unnamed-tmpfile` feature of this Crate,
112+
//! This **Linux**-specific behavior is controlled by the `unnamed-tmpfile` feature of this Crate,
112113
//! which is enabled by default.
113114
//!
114115
//! ## Notes and Limitations

0 commit comments

Comments
 (0)