diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-08-05 19:13:08 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-05 19:13:08 +0200 |
| commit | a4c0ee6df7cd54a3b31524e2c6aaf2b15b61a4d2 (patch) | |
| tree | c8b8d8d36e71caba7e2d8be294bb8382c57a563f | |
| parent | cfa1f61154193da9a12420cb9cf300b2f3d736b2 (diff) | |
| parent | 53e66a383f2859002f7b09c2708c0dacd754176d (diff) | |
Merge pull request #345 from Liamolucko/forward-task-attributes
Forward attributes to generated task function
| -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 3dc295fc1..d00baebfe 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 { | |||
| 110 | quote!(impl ::core::future::Future + 'static) | 110 | quote!(impl ::core::future::Future + 'static) |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | let attrs = &task_fn.attrs; | ||
| 114 | |||
| 113 | let result = quote! { | 115 | let result = quote! { |
| 116 | #(#attrs)* | ||
| 114 | #visibility fn #name(#args) -> #embassy_path::executor::SpawnToken<#impl_ty> { | 117 | #visibility fn #name(#args) -> #embassy_path::executor::SpawnToken<#impl_ty> { |
| 115 | use #embassy_path::executor::raw::Task; | 118 | use #embassy_path::executor::raw::Task; |
| 116 | #task_fn | 119 | #task_fn |
