[−][src]Struct protobuf::reflect::FieldDescriptor
Field descriptor.
Can be used for runtime reflection.
Implementations
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[src]
impl !Send for FieldDescriptor[src]
impl Sync for FieldDescriptor[src]
impl Unpin for FieldDescriptor[src]
impl !UnwindSafe for FieldDescriptor[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,