Skip to main content

include_first

Attribute Macro include_first 

Source
#[include_first]
Expand description

Evaluates include_str! macros early.

This can be used to apply them in the context of a macro_rules! declaration, rather than in the context where the macro is used.

§Example

use include_first::include_first;

#[macro_export]
#[include_first]
macro_rules! generate_asm {
    ($foo:expr) => {
        core::arch::global_asm!(
            include_str!("entrypoint.S"),
            foo = const $foo,
        );
    }
}