Skip to content

Commit d7ca4b6

Browse files
committed
feat: add target_os-dependent autoconfiguration
Signed-off-by: Martin Kröning <[email protected]>
1 parent ab683b0 commit d7ca4b6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ zerocopy = { version = "0.7", default-features = false, optional = true }
1919
zerocopy-derive = { version = "0.7", optional = true }
2020

2121
[features]
22-
default = ["linux"]
22+
default = []
2323
linux = []
2424
macos = []
2525
num_enum = ["dep:num_enum"]

src/lib.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
//! # Features
44
//!
55
//! This crate has the following Cargo features:
6-
//! - `linux` (default) enables the [`linux`] module.
6+
//! - `linux` enables the [`linux`] module.
7+
//! - Automatically enabled on Linux systems.
78
//! - `macos` enables the [`macos`] module.
9+
//! - Automatically enabled on macOS systems.
810
//! - `num_enum` derives the following traits for enums:
911
//! - [`num_enum::IntoPrimitive`]
1012
//! - [`num_enum::TryFromPrimitive`]
@@ -22,11 +24,21 @@
2224
///
2325
/// [`fuse(4)`]: https://www.man7.org/linux/man-pages/man4/fuse.4.html
2426
/// [`linux/fuse.h`]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fuse.h?h=v6.9
25-
#[cfg(feature = "linux")]
27+
#[cfg(any(target_os = "linux", feature = "linux"))]
2628
pub mod linux;
2729

2830
/// macFUSE device interface ([`fuse_kernel.h`]).
2931
///
3032
/// [`fuse_kernel.h`]: https://github.com/osxfuse/fuse/blob/6f7322893456f6ff9db145f096b9bfc2ba95d627/include/fuse_kernel.h
31-
#[cfg(feature = "macos")]
33+
#[cfg(any(target_os = "macos", feature = "macos"))]
3234
pub mod macos;
35+
36+
#[cfg(any(target_os = "linux", target_os = "macos"))]
37+
pub mod os {
38+
//! OS-specific FUSE device interface.
39+
40+
#[cfg(target_os = "linux")]
41+
pub use super::linux::*;
42+
#[cfg(target_os = "macos")]
43+
pub use super::macos::*;
44+
}

0 commit comments

Comments
 (0)