Skip to main content

rustix/fs/
mod.rs

1//! Filesystem operations.
2
3mod abs;
4mod at;
5mod constants;
6#[cfg(linux_kernel)]
7mod copy_file_range;
8#[cfg(all(
9    feature = "alloc",
10    not(any(target_os = "espidf", target_os = "horizon", target_os = "redox"))
11))]
12mod dir;
13#[cfg(not(any(
14    apple,
15    netbsdlike,
16    target_os = "dragonfly",
17    target_os = "espidf",
18    target_os = "haiku",
19    target_os = "horizon",
20    target_os = "redox",
21    target_os = "solaris",
22    target_os = "vita",
23)))]
24mod fadvise;
25pub(crate) mod fcntl;
26#[cfg(apple)]
27mod fcntl_apple;
28#[cfg(apple)]
29mod fcopyfile;
30pub(crate) mod fd;
31#[cfg(all(apple, feature = "alloc"))]
32mod getpath;
33#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
34mod id;
35#[cfg(linux_raw_dep)]
36pub mod inotify;
37#[cfg(linux_kernel)]
38mod ioctl;
39#[cfg(not(any(
40    target_os = "espidf",
41    target_os = "haiku",
42    target_os = "horizon",
43    target_os = "vita",
44    target_os = "wasi"
45)))]
46mod makedev;
47#[cfg(any(linux_kernel, target_os = "freebsd"))]
48mod memfd_create;
49#[cfg(linux_raw_dep)]
50mod openat2;
51#[cfg(linux_kernel)]
52mod raw_dir;
53mod seek_from;
54#[cfg(target_os = "linux")]
55mod sendfile;
56#[cfg(not(target_os = "espidf"))]
57mod special;
58#[cfg(linux_kernel)]
59mod statx;
60#[cfg(not(any(
61    target_os = "espidf",
62    target_os = "horizon",
63    target_os = "redox",
64    target_os = "vita",
65    target_os = "wasi"
66)))]
67mod sync;
68#[cfg(any(apple, linux_kernel, target_os = "hurd"))]
69mod xattr;
70
71pub use abs::*;
72pub use at::*;
73pub use constants::*;
74#[cfg(linux_kernel)]
75pub use copy_file_range::copy_file_range;
76#[cfg(all(
77    feature = "alloc",
78    not(any(target_os = "espidf", target_os = "horizon", target_os = "redox"))
79))]
80pub use dir::{Dir, DirEntry};
81#[cfg(not(any(
82    apple,
83    netbsdlike,
84    target_os = "dragonfly",
85    target_os = "espidf",
86    target_os = "haiku",
87    target_os = "horizon",
88    target_os = "redox",
89    target_os = "solaris",
90    target_os = "vita",
91)))]
92pub use fadvise::fadvise;
93pub use fcntl::*;
94#[cfg(apple)]
95pub use fcntl_apple::*;
96#[cfg(apple)]
97pub use fcopyfile::*;
98pub use fd::*;
99#[cfg(all(apple, feature = "alloc"))]
100pub use getpath::getpath;
101#[cfg(not(target_os = "wasi"))]
102pub use id::*;
103#[cfg(linux_kernel)]
104pub use ioctl::*;
105#[cfg(not(any(
106    target_os = "espidf",
107    target_os = "haiku",
108    target_os = "horizon",
109    target_os = "vita",
110    target_os = "wasi"
111)))]
112pub use makedev::*;
113#[cfg(any(linux_kernel, target_os = "freebsd"))]
114pub use memfd_create::memfd_create;
115#[cfg(linux_raw_dep)]
116pub use openat2::openat2;
117#[cfg(linux_kernel)]
118pub use raw_dir::{RawDir, RawDirEntry};
119pub use seek_from::SeekFrom;
120#[cfg(target_os = "linux")]
121pub use sendfile::sendfile;
122#[cfg(not(target_os = "espidf"))]
123pub use special::*;
124#[cfg(linux_kernel)]
125pub use statx::*;
126#[cfg(not(any(
127    target_os = "espidf",
128    target_os = "horizon",
129    target_os = "redox",
130    target_os = "vita",
131    target_os = "wasi"
132)))]
133pub use sync::sync;
134#[cfg(any(apple, linux_kernel, target_os = "hurd"))]
135pub use xattr::*;
136
137/// Re-export types common to POSIX-ish platforms.
138#[cfg(feature = "std")]
139#[cfg(unix)]
140pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
141#[cfg(feature = "std")]
142#[cfg(all(wasi_ext, target_os = "wasi"))]
143pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};