Attribute Macro multiversion::target
source · #[target]Expand description
Provides a less verbose equivalent to the target_arch and target_feature attributes.
A function tagged with #[target("[x86|x86_64]+avx+avx2")], for example, is equivalent to a
function tagged with each of:
#[target_arch(any(target_arch = "x86", target_arch = "x86_64"))]#[target_feature(enable = "avx")]#[target_feature(enable = "avx2")]
The target attribute is intended to be used in tandem with the multiversion attribute
to produce hand-written multiversioned functions.
§Helper attributes
#[safe_inner]- Indicates that the inner contents of the function are safe and requires the use of
unsafeblocks to callunsafefunctions.
- Indicates that the inner contents of the function are safe and requires the use of
§Static dispatching
The target attribute allows functions called inside the function to be statically dispatched.
See static dispatching for more information.
§Conditional compilation
The target attribute supports conditional compilation with the #[target_cfg] helper
attribute. See conditional compilation for more information.