n0-computer / quic-rpc

A streaming rpc system based on quic
Other
94 stars 12 forks source link

feat: add optional macros to reduce boilerplate #1

Closed Frando closed 1 year ago

Frando commented 1 year ago

I digged out some macro_rules code for RPC interface declarations that I wrote for an RPC experiment a while back. It was quite straightforward to adapt to quic-rpc, combined it with the request_enum macro from examples/store.rs and then got lost a bit and made the store example work.

The macros are completely optional. They also do not introduce any traits, because async traits would require boxing the futures, and so far quic-rpc works without, which is nice.

All idents have to be passed in the macro call. I think that's a feature because less magic. The invocation of derive_rpc_service! in examples/macro.rs quite literally creates the code that can be seen in examples/store.rs.

rklaehn commented 1 year ago

Fixed the formatting and merged this. Thanks.