diff options
author | Liam Murphy <liampm32@gmail.com> | 2021-08-05 15:35:50 +1000 |
---|---|---|
committer | Liam Murphy <liampm32@gmail.com> | 2021-08-05 15:35:50 +1000 |
commit | 53e66a383f2859002f7b09c2708c0dacd754176d (patch) | |
tree | c8b8d8d36e71caba7e2d8be294bb8382c57a563f | |
parent | cfa1f61154193da9a12420cb9cf300b2f3d736b2 (diff) | |
download | embassy-53e66a383f2859002f7b09c2708c0dacd754176d.zip |
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.
-rw-r--r-- | embassy-macros/src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index 3dc295fc..d00baebf 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -110,7 +110,10 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream { quote!(impl ::core::future::Future + 'static) }; + let attrs = &task_fn.attrs; + let result = quote! { + #(#attrs)* #visibility fn #name(#args) -> #embassy_path::executor::SpawnToken<#impl_ty> { use #embassy_path::executor::raw::Task; #task_fn |