Skip to content

Commit

Permalink
Fix call macro for empty responses
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelhetzel committed Oct 22, 2024
1 parent 79f569e commit f549786
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions edgeless_function_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ pub fn generate(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
return edgeless_function::CallRet::Reply(edgeless_function::owned_data::OwnedByteBuff::new_from_slice(&serialized));
};

(return_type_ident, return_statement)
(Some(return_type_ident), return_statement)
} else {
(quote::format_ident!("()"), quote! {
(None, quote! {
return edgeless_function::CallRet::NoReply;
})
};
Expand All @@ -97,9 +97,16 @@ pub fn generate(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
return edgeless_function::CallRet::NoReply;
});

quote! {
fn #method_name(_src : InstanceId, data: Self::#type_ident) -> Self::#return_type_ident;
if let Some(return_type_ident) = return_type_ident {
quote! {
fn #method_name(_src : InstanceId, data: Self::#type_ident) -> Self::#return_type_ident;
}
} else {
quote! {
fn #method_name(_src : InstanceId, data: Self::#type_ident) -> ();
}
}

}
}

Expand Down

0 comments on commit f549786

Please sign in to comment.