1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-27 21:09:02 +02:00

macros: Add actix-reexport feature (#218)

This commit is contained in:
Yuki Okushi
2020-12-03 08:59:13 +09:00
committed by GitHub
parent 89e56cf661
commit 76d956e25c
8 changed files with 36 additions and 18 deletions

View File

@ -33,14 +33,25 @@ pub fn main(_: TokenStream, item: TokenStream) -> TokenStream {
sig.asyncness = None;
(quote! {
#(#attrs)*
#vis #sig {
actix_rt::System::new(stringify!(#name))
.block_on(async move { #body })
}
})
.into()
if cfg!(feature = "actix-reexport") {
(quote! {
#(#attrs)*
#vis #sig {
actix::System::new(stringify!(#name))
.block_on(async move { #body })
}
})
.into()
} else {
(quote! {
#(#attrs)*
#vis #sig {
actix_rt::System::new(stringify!(#name))
.block_on(async move { #body })
}
})
.into()
}
}
/// Marks async test function to be executed by actix runtime.