Skip to main content

Module features

Module features 

Source
Expand description

Edition feature resolution.

Protoc emits only unresolved (user-written) features in descriptor options. This module resolves them by walking the descriptor hierarchy (file → message → field/enum/oneof) and merging overrides onto edition defaults, matching the algorithm in protobuf’s C++ FeatureResolver.

Used by both [crate::pool::DescriptorPool] (runtime reflection) and buffa-codegen (re-exported via buffa_codegen::features). Codegen adds one extra resolver, resolve_field, that needs CodeGenContext and so lives in buffa-codegen.

Structs§

ResolvedFeatures
The resolved set of edition features for a protobuf element.

Enums§

EnumType
Controls how unknown enum values are handled.
FieldPresence
Controls whether field presence is tracked.
JsonFormat
Controls JSON format support.
MessageEncoding
Controls wire encoding of message fields.
RepeatedFieldEncoding
Controls wire encoding of repeated scalar fields.
Utf8Validation
Controls UTF-8 validation for string fields.

Functions§

enum_features
Extract the unresolved FeatureSet from enum options.
field_features
Extract the unresolved FeatureSet from field options.
for_file
Resolve a file’s effective features from its declared syntax/edition and any explicit file-level feature overrides.
message_features
Extract the unresolved FeatureSet from message options.
oneof_features
Extract the unresolved FeatureSet from oneof options.
resolve_child
Compute a child element’s resolved features by merging the parent’s resolved features with the child’s unresolved FeatureSet override.