pub struct FieldDescriptor { /* private fields */ }
Expand description
A protobuf message definition.
Implementations§
Source§impl FieldDescriptor
impl FieldDescriptor
Sourcepub fn parent_pool(&self) -> &DescriptorPool
pub fn parent_pool(&self) -> &DescriptorPool
Gets a reference to the DescriptorPool
this field is defined in.
Sourcepub fn parent_file(&self) -> FileDescriptor
pub fn parent_file(&self) -> FileDescriptor
Gets the FileDescriptor
this field is defined in.
Sourcepub fn parent_message(&self) -> &MessageDescriptor
pub fn parent_message(&self) -> &MessageDescriptor
Gets a reference to the MessageDescriptor
this field is defined in.
Sourcepub fn full_name(&self) -> &str
pub fn full_name(&self) -> &str
Gets the full name of the message field, e.g. my.package.MyMessage.my_field
.
Sourcepub fn path(&self) -> &[i32]
pub fn path(&self) -> &[i32]
Gets the path where this message field is defined within the FileDescriptorProto
, e.g. [4, 0, 2, 0]
.
See path
for more details on the structure of the path.
Sourcepub fn field_descriptor_proto(&self) -> &FieldDescriptorProto
pub fn field_descriptor_proto(&self) -> &FieldDescriptorProto
Gets a reference to the raw FieldDescriptorProto
wrapped by this FieldDescriptor
.
Sourcepub fn options(&self) -> DynamicMessage
pub fn options(&self) -> DynamicMessage
Decodes the options defined for this FieldDescriptor
, including any extension options.
Sourcepub fn json_name(&self) -> &str
pub fn json_name(&self) -> &str
Gets the name used for JSON serialization.
This is usually the camel-cased form of the field name, unless another value is set in the proto file.
Sourcepub fn is_list(&self) -> bool
pub fn is_list(&self) -> bool
Whether this field is a list type.
Equivalent to checking that the cardinality is Repeated
and that
is_map
returns false
.
Sourcepub fn is_map(&self) -> bool
pub fn is_map(&self) -> bool
Whether this field is a map type.
Equivalent to checking that the cardinality is Repeated
and that
the field type is a message where is_map_entry
returns true
.
Sourcepub fn is_packed(&self) -> bool
pub fn is_packed(&self) -> bool
Whether this field is a list encoded using packed encoding.
Sourcepub fn cardinality(&self) -> Cardinality
pub fn cardinality(&self) -> Cardinality
The cardinality of this field.
Sourcepub fn supports_presence(&self) -> bool
pub fn supports_presence(&self) -> bool
Whether this field supports distinguishing between an unpopulated field and the default value.
For proto2 messages this returns true
for all non-repeated fields.
For proto3 this returns true
for message fields, and fields contained
in a oneof
.
Sourcepub fn containing_oneof(&self) -> Option<OneofDescriptor>
pub fn containing_oneof(&self) -> Option<OneofDescriptor>
Gets a OneofDescriptor
representing the oneof containing this field,
or None
if this field is not contained in a oneof.
Trait Implementations§
Source§impl Clone for FieldDescriptor
impl Clone for FieldDescriptor
Source§fn clone(&self) -> FieldDescriptor
fn clone(&self) -> FieldDescriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more