Crates.io | cfg_boost |
lib.rs | cfg_boost |
version | 1.0.0 |
source | src |
created_at | 2023-04-12 14:23:02.054936 |
updated_at | 2023-04-12 14:23:02.054936 |
description | Revamped syntax and macros to easily manage all #[cfg] parameters in one package. Compatible with stable toolchain and no dependencies. See README / Homepage for more details. |
homepage | https://github.com/NickelAngeStudio/cfg_boost/wiki |
repository | https://github.com/NickelAngeStudio/cfg_boost |
max_upload_size | |
id | 836961 |
size | 65,289 |
Revamped syntax and macros to easily manage all #[cfg] parameters in one package. See features to get the full list of features like aliases, attributes, automatic dependency tag documentation and more.
Transform this :
#[cfg(any(doc, any(target_os = "linux", target_os = "macos", target_os = "windows")))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))))]
pub mod desktop_mod;
#[cfg(any(doc, any(target_os = "linux", target_os = "macos", target_os = "windows")))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))))]
pub use desktop_mod::Struct as Struct;
#[cfg(any(doc, any(target_os = "ios", target_os = "android")))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "ios", target_os = "android"))))]
pub mod mobile_mod;
#[cfg(any(doc, any(target_os = "ios", target_os = "android")))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "ios", target_os = "android"))))]
pub use mobile_mod::Struct1 as Struct1;
#[cfg(any(doc, any(target_os = "ios", target_os = "android")))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "ios", target_os = "android"))))]
pub use mobile_mod::Struct2 as Struct2;
#[cfg(any(doc, any(target_os = "ios", target_os = "android")))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "ios", target_os = "android"))))]
pub fn mobile_only_fn() {}
Into this :
target_cfg!{
desktop => {
pub mod desktop_mod;
pub use desktop_mod::Struct as Struct;
},
mobile => {
pub mod mobile_mod;
pub use mobile_mod::Struct1 as Struct1;
pub use mobile_mod::Struct2 as Struct2;
pub fn mobile_only_fn() {}
}
}
See examples for more use cases.
Execute this command in your Rust project folder.
cargo add cfg_boost
cfg_boost has no dependencies and only use stable rust library.
See cfg_boost wiki, it contains a LOT of information.
Sponsor me via GitHub Sponsors and get your sponsor royalty tier.