I am looking to group all my imports with conditional compilation.
I know that the #[cfg(target_os = "windows")]
attribute organises the import, but it only works for one import.
How can I import multiple packages with one conditional compilation attribute?
I am looking for something like:
#[cfg(target_os = "windows")]
{
use windows_lib1;
use windows_lib2;
}
#[cfg(target_os = "linux")]
{
use linux_lib1;
use linux_lib2;
}
You can group use imports this way:
#[cfg(target_os = "windows")]
use {
windows_lib1,
windows_lib2,
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With