You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hiya! Big fan of dll-syringe, used it in countless projects. Something that's bugged me about the payload-procedure macro is the fact it's function-like, requiring me to wrap my function in an indent and also lose formatting. I found myself making a <function name>_inner function and then calling it from the remote procedure so I could have rustfmt work again.
Out of boredom today I wrote an attribute macro that you can slap on your functions. It produces nearly the exact same result as the current macro, but it's just one extra line and doesn't affect formatting. The only thing that is different is an addition of braces inside of the function, which doesn't seem to affect anything. I've tested this in my own project (closed source so I can't link an example - sorry!), and it seems to work great.
The source for this is available in this gist (42 lines). Is this something worth PRing? Noting that it adds dependencies on quote and syn - also, this is my first time using those libraries, so I'm not entirely sure if I'm doing something in a bad way.
Here's a before and after viewed with cargo-expand, on both the current macro and my macro:
#[remote_procedure]fnrpc_function_one(number:u32) -> bool{
number % 2 == 0}
dll_syringe::payload_procedure! {fn rpc_function_two(number: u32) -> bool{
number % 2 == 0}}
Hiya! Big fan of dll-syringe, used it in countless projects. Something that's bugged me about the payload-procedure macro is the fact it's function-like, requiring me to wrap my function in an indent and also lose formatting. I found myself making a
<function name>_inner
function and then calling it from the remote procedure so I could have rustfmt work again.Out of boredom today I wrote an attribute macro that you can slap on your functions. It produces nearly the exact same result as the current macro, but it's just one extra line and doesn't affect formatting. The only thing that is different is an addition of braces inside of the function, which doesn't seem to affect anything. I've tested this in my own project (closed source so I can't link an example - sorry!), and it seems to work great.
The source for this is available in this gist (42 lines). Is this something worth PRing? Noting that it adds dependencies on
quote
andsyn
- also, this is my first time using those libraries, so I'm not entirely sure if I'm doing something in a bad way.Here's a before and after viewed with cargo-expand, on both the current macro and my macro:
The text was updated successfully, but these errors were encountered: