1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! Unix-specific extensions to [`fs`](super).
//!
//! The extension traits add to the builders and the entries of the parent module what the traits of
//! the same names in [`std::os::unix::fs`] add to those of std. Import the trait, then call its
//! methods on the builder or the entry. [`Metadata`](super::Metadata),
//! [`Permissions`](super::Permissions) and [`FileType`](super::FileType) are the types of std, so
//! the traits of std that extend them are re-exported here.
use ;
use Sealed;
use crateunblock;
pub use ;
/// Makes `dst` a symbolic link to `src`.
///
/// Runs [`std::os::unix::fs::symlink`] as blocking work. The link stores the path `src` as given. A
/// relative `src` is read relative to the directory of the link, not the working directory of the
/// process. `src` need not exist.
///
/// # Example
///
/// ```
/// use futures::executor::block_on;
/// use zruntime::fs::{self, unix};
///
/// # let pid = std::process::id();
/// # let dir = std::env::temp_dir().join(format!("zruntime-fs-doc-symlink-{pid}"));
/// # std::fs::create_dir_all(&dir).unwrap();
/// block_on(async {
/// let target = dir.join("target.txt");
/// let link = dir.join("link.txt");
/// fs::write(&target, "pointed at").await?;
///
/// unix::symlink(&target, &link).await?;
///
/// assert_eq!(fs::read_link(&link).await?, target);
/// assert_eq!(fs::read_to_string(&link).await?, "pointed at");
///
/// std::io::Result::Ok(())
/// })
/// .unwrap();
/// # std::fs::remove_dir_all(&dir).unwrap();
/// ```
pub async
/// Unix-specific extensions to [`DirBuilder`](super::DirBuilder).
///
/// Only that type implements it. The trait is sealed.
/// Unix-specific extensions to [`DirEntry`](super::DirEntry).
///
/// Only that type implements it. The trait is sealed.
/// Unix-specific extensions to [`OpenOptions`](super::OpenOptions).
///
/// Only that type implements it. The trait is sealed.