Closed paulfariello closed 4 months ago
Hi, thanks for working to fix this! Interesting, I hadn't thought about supporting #[cfg()]
on RPC methods. I'm curious (though doesn't affect what I think about this PR), what's your use case?
What about a more selective fix, to basically only add attributes to the enum variants if if they are #[cfg()]
attributes? Right now you can see there is a failing clippy check due to doc comments (/// like this
) being added to match arms.
Our main use case is to disable a specific RPC when building our app for production. This RPC is mainly used for simulation of a specific behavior.
Sure, trying to look for specific #[cfg(…)]
attributes seems quite reasonable, I'll work on it.
Could you also add a test case in https://github.com/google/tarpc/blob/master/plugins/tests/service.rs?
Thanks very much for doing this!
Currently it's not possible to use a
#[cfg(…)]
attribute on a method.Would result in:
This PR propose to simply propagate all attributes to every enum, and impl that are linked to a given rpc. Obviously this might cause issue with attributes that are only supposed to be used on function.
Would this kind of solution be acceptable? If not, what kind of solution would you consider to enable
#[cfg(…)]
usage?