-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Description
I have tried:
fn main() {
let customize = protobuf_codegen::Customize::default()
.generate_accessors(true)
.generate_getter(true)
.oneofs_non_exhaustive(false); // <--- !!!
protobuf_codegen::Codegen::new()
.inputs(&vec!["my_message.proto"])
.out_dir(".")
.include(".")
.customize(customize)
.run()
.expect("Running protoc failed.");
}
Example proto:
syntax = "proto3";
message MyMessage {
string one = 1;
oneof MyEnum {
string two = 2;
string three = 3;
}
}
Result:
// (...)
/// Nested message and enums of message `MyMessage`
pub mod my_message {
#[derive(Clone,PartialEq,Debug)]
#[non_exhaustive]
// @@protoc_insertion_point(oneof:MyMessage.MyEnum)
pub enum MyEnum {
// @@protoc_insertion_point(oneof_field:MyMessage.two)
Two(::std::string::String),
// @@protoc_insertion_point(oneof_field:MyMessage.three)
Three(::std::string::String),
}
// (...)
versions:
protobuf = "3.7.1"
protobuf-codegen = "3.7.1"
Metadata
Metadata
Assignees
Labels
No labels