Struct prost_reflect::FieldDescriptor
source · 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 moresource§impl Debug for FieldDescriptor
impl Debug for FieldDescriptor
source§impl PartialEq<FieldDescriptor> for FieldDescriptor
impl PartialEq<FieldDescriptor> for FieldDescriptor
source§fn eq(&self, other: &FieldDescriptor) -> bool
fn eq(&self, other: &FieldDescriptor) -> bool
self
and other
values to be equal, and is used
by ==
.