Skip to content

Commit a0c6978

Browse files
committed
Reduce minimal accessors to just getter
1 parent 7db4351 commit a0c6978

4 files changed

Lines changed: 1417 additions & 712 deletions

File tree

examples/file-descriptor-set/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ fn main() {
1111
.no_partial_eq_impl(true)
1212
.minimal_accessors(true),
1313
)
14+
// Override minimal accessors setting for specific paths, since the generator calls `set_`
15+
// APIs on specific messages
16+
.configure_many(
17+
&[
18+
".google.protobuf.DescriptorProto",
19+
".google.protobuf.FieldDescriptorProto",
20+
".google.protobuf.FieldOptions",
21+
".google.protobuf.OneofDescriptorProto",
22+
".google.protobuf.MessageOptions",
23+
".google.protobuf.EnumValueDescriptorProto",
24+
],
25+
Config::new().minimal_accessors(false),
26+
)
1427
.compile_protos(&["google/protobuf/descriptor.proto"], "descriptor.rs")
1528
.unwrap();
1629
}

micropb-gen/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ config_decl! {
484484
/// Only generate minimal accessors for message types.
485485
///
486486
/// If enabled, the only accessors that will be generated for this message type will be the
487-
/// getter and setter methods on optional fields. This won't reduce the compiled code size, but
488-
/// it will significantly reduce the size of the output source file.
487+
/// getter methods on optional fields. This won't reduce the compiled code size, but it will
488+
/// significantly reduce the size of the output source file.
489489
minimal_accessors: Option<bool>,
490490

491491
// General configs

0 commit comments

Comments
 (0)