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
use crateOp;
use io;
use Path;
/// Creates a directory on the local filesystem.
///
/// # Errors
///
/// This function will return an error in the following situations, but is not
/// limited to just these cases:
///
/// * User lacks permissions to create a directory at `path`
/// * [`io::ErrorKind`] would be set to `PermissionDenied`
/// * A parent of the given path doesn't exist.
/// * [`io::ErrorKind`] would be set to `NotFound` or `NotADirectory`
/// * `path` already exists.
/// * [`io::ErrorKind`] would be set to `AlreadyExists`
///
/// [`ErrorKind`]: std::io::ErrorKind
/// # Examples
///
/// ```no_run
/// use tokio_uring_xitca::fs::create_dir;
///
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
/// tokio_uring_xitca::start(async {
/// create_dir("/some/dir").await?;
/// Ok::<(), std::io::Error>(())
/// })?;
/// Ok(())
/// }
/// ```
pub async
/// Removes a directory on the local filesystem.
///
/// This will only remove empty directories with no children. If you want to destroy the entire
/// contents of a directory, you may try [`remove_dir_all`] which uses the standard Tokio executor.
/// There currently is no implementation of `remove_dir_all` in tokio-uring.
///
/// [`remove_dir_all`]: https://docs.rs/tokio/latest/tokio/fs/fn.remove_dir_all.html
///
/// # Errors
///
/// This function will return an error in the following situations, but is not
/// limited to just these cases:
///
/// * `path` doesn't exist.
/// * [`io::ErrorKind`] would be set to `NotFound`
/// * `path` isn't a directory.
/// * [`io::ErrorKind`] would be set to `NotADirectory`
/// * The user lacks permissions to modify/remove the directory at the provided `path`.
/// * [`io::ErrorKind`] would be set to `PermissionDenied`
/// * The directory isn't empty.
/// * [`io::ErrorKind`] would be set to `DirectoryNotEmpty`
///
/// # Examples
///
/// ```no_run
/// use tokio_uring_xitca::fs::remove_dir;
///
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
/// tokio_uring_xitca::start(async {
/// remove_dir("/some/dir").await?;
/// Ok::<(), std::io::Error>(())
/// })?;
/// Ok(())
/// }
/// ```
pub async