Forward attributes to generated task function

Fixes #18

Syn considers doc comments to be attributes, so forwarding those fixes the issue.
It's probably a good idea to forward most attributes anyway.
This commit is contained in:
Liam Murphy 2021-08-05 15:35:50 +10:00
parent cfa1f61154
commit 53e66a383f

View File

@ -110,7 +110,10 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream {
quote!(impl ::core::future::Future + 'static) quote!(impl ::core::future::Future + 'static)
}; };
let attrs = &task_fn.attrs;
let result = quote! { let result = quote! {
#(#attrs)*
#visibility fn #name(#args) -> #embassy_path::executor::SpawnToken<#impl_ty> { #visibility fn #name(#args) -> #embassy_path::executor::SpawnToken<#impl_ty> {
use #embassy_path::executor::raw::Task; use #embassy_path::executor::raw::Task;
#task_fn #task_fn