You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
817 B
49 lines
817 B
use super::*;
|
|
|
|
/// Inherit imports from outer package.
|
|
#[macro_export] macro_rules! inherit {
|
|
() => {
|
|
#[allow(unused_imports)] use super::*;
|
|
};
|
|
}
|
|
|
|
/// Conditional compilation of code depending on if debug assertions are enabled.
|
|
#[macro_export] macro_rules! debug_if {
|
|
(if {$($debug:tt)*} else {$($prod:tt)*}) => {
|
|
cfg_if! {
|
|
if #[cfg(debug_assertions)] {
|
|
{ $($debug)* }
|
|
} else {
|
|
{ $($prod)* }
|
|
}
|
|
}
|
|
};
|
|
(if {$($debug:tt)*}) => {
|
|
debug_if!(if {$($debug)*} else {})
|
|
};
|
|
(else {$($prod:tt)*}) => {
|
|
debug_if!(if {} else {$($prod)*})
|
|
};
|
|
}
|
|
|
|
fn _debug_if_test()
|
|
{
|
|
debug_if!{
|
|
if {
|
|
println!("Debug");
|
|
} else {
|
|
println!("Release");
|
|
}
|
|
}
|
|
debug_if!{
|
|
if {
|
|
println!("Debug 2");
|
|
}
|
|
}
|
|
debug_if!{
|
|
else {
|
|
println!("Release 2");
|
|
}
|
|
}
|
|
}
|