| 1 |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
/// conditionally declare the module only if `feature` is enabled. If the |
| 5 |
/// feature is enabled, import all symbols into the main namespace. |
| 6 |
/// Disable rustfmt because it wants the `mod` and `pub use` statement to be on |
| 7 |
/// different levels of indentation |
| 8 |
#[rustfmt::skip] |
| 9 |
macro_rules! conditional_module { |
| 10 |
($mod_name:ident, $feature_name:literal) => { |
| 11 |
// bindgen will automatically rustfmt everything, but we use nightly rustfmt as |
| 12 |
// the authoritiative rustfmt so that doesn't work for us |
| 13 |
#[cfg(feature = $feature_name)] |
| 14 |
#[rustfmt::skip] |
| 15 |
mod $mod_name; |
| 16 |
|
| 17 |
#[cfg(feature = $feature_name)] |
| 18 |
pub use $mod_name::*; |
| 19 |
}; |
| 20 |
} |
| 21 |
|
| 22 |
conditional_module!(quic, "quic"); |
| 23 |
conditional_module!(internal, "internal"); |
| 24 |
<TOKEN_REPLACED_WITH_UNSTABLE_FEATURES> |
| 25 |
// conditional_module!(foo, "unstable-foo"); |