1
2
3macro_rules! if_any_two_features {
4 ($first:literal $(, $feature:literal)+ { $item:item }) => {
5 #[cfg(all(feature = $first, any($(feature = $feature),*)))]
6 $item
7
8 if_any_two_features!($($feature),* { $item });
9 };
10 ($first:literal { $item:item }) => {};
11}
12
13macro_rules! if_not_any_two_features {
14 (@inner $first:literal $(, $feature:literal)+ { $item:item }) => {
15 #[cfg(not(all(feature = $first, any($(feature = $feature),*))))]
16 if_not_any_two_features!(@inner $($feature),* {
17 $item
18 });
19 };
20 (@inner $first:literal { $item:item }) => {
21 $item
22 };
23 ($($features:literal),* { $first:item $($items:item)* }) => {
24 if_not_any_two_features!(@inner $($features),* { $first });
25
26 if_not_any_two_features!($($features),* { $($items)* });
27 };
28 ($($features:literal),* { }) => {};
29}
30
31if_any_two_features!("x86_64", "i386", "arm", "ppc", "mips", "mipsel", "mips64", "mips64el" {
32 compile_error!("Cannot enable two features at once, make sure you are using `default-features = false`");
33});
34
35if_not_any_two_features!("x86_64", "i386", "arm", "ppc", "mips", "mipsel", "mips64", "mips64el" {
36
37 #[allow(nonstandard_style)]
38 #[allow(improper_ctypes)] mod bindings;
40
41 mod extensions;
42
43 pub use bindings::*;
44});