Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
match_target in multiversion::target - Rust
[go: Go Back, main page]

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"),
    }
}