prost icon indicating copy to clipboard operation
prost copied to clipboard

prost_derive::Oneof is undocumented -- is it not intended to be used?

Open cbeck88 opened this issue 2 years ago • 1 comments

I am looking to use prost_derive::Oneof to manually create rust enums that encode/decode to protobuf oneof's.

I noticed that this proc macro is nearly undocumented: https://docs.rs/prost-derive/latest/prost_derive/derive.Oneof.html

Is this intentional?


There have been some other places like prost::DecodeError::new where API's were exposed but only so that other parts of prost can make use of them, and not intended to be used by users: https://github.com/tokio-rs/prost/pull/421#issuecomment-758867131

It seems to me possible that #[derive(::prost::Oneof)] is only intended to be used by prost-build and not by me. Perhaps more breaking changes are planned?

Is it expected that I might use #[derive(::prost::Oneof)] in my code? Or, it's similar to DecodeError::new and this isn't really expected, and if I do use it, then I should expect breaking changes?

cbeck88 avatar Jun 07 '22 16:06 cbeck88

I don't think the use of the derive macros is limited to just prost-build and I don't expect any breaking changes really. That said, I think not many people go that route and so there hasn't been a strong need for documentation. I would be happy to accept a PR that adds docs etc if you're interested working on that.

LucioFranco avatar Jun 08 '22 15:06 LucioFranco