Struct protobuf::reflect::FieldDescriptor [−][src]
pub struct FieldDescriptor { /* fields omitted */ }
Field descriptor.
Can be used for runtime reflection.
Implementations
impl FieldDescriptor
[src]
impl FieldDescriptor
[src]pub fn proto(&self) -> &'static FieldDescriptorProto
[src]
Get .proto
description of field
pub fn name(&self) -> &'static str
[src]
Field name as specified in .proto
file
pub fn json_name(&self) -> &str
[src]
pub fn is_repeated(&self) -> bool
[src]
If this field repeated?
pub fn has_field(&self, m: &dyn Message) -> bool
[src]
Check if field is set in given message.
For repeated field or map field return true
if
collection is not empty.
Panics
If this field belongs to a different message type.
pub fn len_field(&self, m: &dyn Message) -> usize
[src]
Return length of repeated field.
For singular field return 1
if field is set and 0
otherwise.
Panics
If this field belongs to a different message type.
pub fn get_message<'a>(&self, m: &'a dyn Message) -> &'a dyn Message
[src]
Get message field or default instance if field is unset.
Panics
If this field belongs to a different message type or field type is not message.
pub fn get_enum(&self, m: &dyn Message) -> &'static EnumValueDescriptor
[src]
Get enum
field.
Panics
If this field belongs to a different message type
or field type is not singular enum
.
pub fn get_str<'a>(&self, m: &'a dyn Message) -> &'a str
[src]
Get string
field.
Panics
If this field belongs to a different message type
or field type is not singular string
.
pub fn get_bytes<'a>(&self, m: &'a dyn Message) -> &'a [u8]ⓘ
[src]
Get bytes
field.
Panics
If this field belongs to a different message type
or field type is not singular bytes
.
pub fn get_u32(&self, m: &dyn Message) -> u32
[src]
Get u32
field.
Panics
If this field belongs to a different message type
or field type is not singular u32
.
pub fn get_u64(&self, m: &dyn Message) -> u64
[src]
Get u64
field.
Panics
If this field belongs to a different message type
or field type is not singular u64
.
pub fn get_i32(&self, m: &dyn Message) -> i32
[src]
Get i32
field.
Panics
If this field belongs to a different message type
or field type is not singular i32
.
pub fn get_i64(&self, m: &dyn Message) -> i64
[src]
Get i64
field.
Panics
If this field belongs to a different message type
or field type is not singular i64
.
pub fn get_bool(&self, m: &dyn Message) -> bool
[src]
Get bool
field.
Panics
If this field belongs to a different message type or
field type is not singular bool
.
pub fn get_f32(&self, m: &dyn Message) -> f32
[src]
Get float
field.
Panics
If this field belongs to a different message type or
field type is not singular float
.
pub fn get_f64(&self, m: &dyn Message) -> f64
[src]
Get double
field.
Panics
If this field belongs to a different message type
or field type is not singular double
.
pub fn get_reflect<'a>(&self, m: &'a dyn Message) -> ReflectFieldRef<'a>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for FieldDescriptor
impl !RefUnwindSafe for FieldDescriptor
impl !Send for FieldDescriptor
impl !Send for FieldDescriptor
impl Sync for FieldDescriptor
impl Sync for FieldDescriptor
impl Unpin for FieldDescriptor
impl Unpin for FieldDescriptor
impl !UnwindSafe for FieldDescriptor
impl !UnwindSafe for FieldDescriptor