Macro multiversion::target::match_target
source · match_target!() { /* proc-macro */ }
Expand description
Match the selected target.
Matching is done at compile time, as if by #[cfg]
. Target matching considers both
detected features and statically-enabled features. Arms that do not match are not
compiled.
This macro only works in a function marked with multiversion
.
§Example
use multiversion::{multiversion, target::match_target};
#[multiversion(targets = "simd")]
fn foo() {
match_target! {
"x86_64+avx" => println!("x86-64 with AVX"),
"aarch64+neon" => println!("AArch64 with Neon"),
_ => println!("another architecture"),
}
}