Skip to main content

cap_std_ext/
lib.rs

1// See https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
2#![deny(missing_docs)]
3#![doc = include_str!("../README.md")]
4#![deny(missing_debug_implementations)]
5#![forbid(unused_must_use)]
6#![deny(unsafe_code)]
7
8use std::io;
9
10// Re-export our dependencies
11pub use cap_primitives;
12#[cfg(feature = "fs_utf8")]
13pub use cap_std::fs_utf8::camino;
14pub use cap_tempfile;
15pub use cap_tempfile::cap_std;
16
17#[cfg(not(windows))]
18pub mod cmdext;
19pub mod dirext;
20
21#[cfg(any(target_os = "android", target_os = "linux"))]
22mod rootdir;
23#[cfg(any(target_os = "android", target_os = "linux"))]
24pub use rootdir::*;
25#[cfg(any(target_os = "android", target_os = "linux"))]
26mod xattrs;
27#[cfg(any(target_os = "android", target_os = "linux"))]
28pub use xattrs::XattrList;
29
30#[cold]
31#[cfg_attr(
32    not(any(target_os = "android", target_os = "linux", test)),
33    allow(dead_code)
34)]
35pub(crate) fn escape_attempt() -> io::Error {
36    io::Error::new(
37        io::ErrorKind::PermissionDenied,
38        "a path led outside of the filesystem",
39    )
40}
41
42/// Prelude, intended for glob import.
43pub mod prelude {
44    #[cfg(not(windows))]
45    pub use super::cmdext::CapStdExtCommandExt;
46    pub use super::dirext::CapStdExtDirExt;
47    #[cfg(feature = "fs_utf8")]
48    pub use super::dirext::CapStdExtDirExtUtf8;
49}