fix(macros): Allow macros to work even if Future is not in scope (#385)
`#[tool]` generates code that uses Future by name for async functions. This means that consumers have to import Future. This commit fixes that by changing the macro expansion to use std::future::Future instead. The same applies to `#[prompt]` as well.
This commit is contained in:
parent
9349f5cb26
commit
a84a3eb79b
1 changed files with 5 additions and 5 deletions
|
|
@ -108,10 +108,10 @@ pub fn prompt(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream>
|
|||
}
|
||||
match &fn_item.sig.output {
|
||||
syn::ReturnType::Default => {
|
||||
quote! { -> futures::future::BoxFuture<#lt, ()> }
|
||||
quote! { -> ::std::pin::Pin<Box<dyn ::std::future::Future<Output = ()> + Send + #lt>> }
|
||||
}
|
||||
syn::ReturnType::Type(_, ty) => {
|
||||
quote! { -> futures::future::BoxFuture<#lt, #ty> }
|
||||
quote! { -> ::std::pin::Pin<Box<dyn ::std::future::Future<Output = #ty> + Send + #lt>> }
|
||||
}
|
||||
}
|
||||
})?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue