macro: enforce Send

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-10-04 14:11:33 +02:00
parent df55ab2dda
commit 589cb7e296

View File

@ -255,13 +255,13 @@ pub fn handle_function(
// `async fn`, since an `async fn` cannot appear as a return type :( // `async fn`, since an `async fn` cannot appear as a return type :(
impl ::std::ops::Deref for #struct_name { impl ::std::ops::Deref for #struct_name {
type Target = fn(#inputs) -> ::std::pin::Pin<Box< type Target = fn(#inputs) -> ::std::pin::Pin<Box<
dyn ::std::future::Future<Output = #return_type> dyn ::std::future::Future<Output = #return_type> + Send
>>; >>;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
const FUNC: fn(#inputs) -> ::std::pin::Pin<Box<dyn ::std::future::Future< const FUNC: fn(#inputs) -> ::std::pin::Pin<Box<dyn ::std::future::Future<
Output = #return_type, Output = #return_type,
>>> = |#inputs| { > + Send>> = |#inputs| {
Box::pin(#struct_name::#impl_checked_ident(#passed_args)) Box::pin(#struct_name::#impl_checked_ident(#passed_args))
}; };
&FUNC &FUNC