zfi_testing_macros/lib.rs
1use self::qemu::parse_qemu_attribute;
2use proc_macro::TokenStream;
3use syn::{parse_macro_input, Error, ItemFn};
4
5mod qemu;
6
7/// Attribute macro applied to a function to run it on QEMU.
8///
9/// This attribute will move the function body into `efi_main` to run it on QEMU. Which mean you
10/// must put everything that are needed within this function.
11#[proc_macro_attribute]
12pub fn qemu(_: TokenStream, item: TokenStream) -> TokenStream {
13 let item = parse_macro_input!(item as ItemFn);
14
15 parse_qemu_attribute(item)
16 .unwrap_or_else(Error::into_compile_error)
17 .into()
18}