Struct protobuf::reflect::MessageDescriptor
source · pub struct MessageDescriptor { /* private fields */ }
Expand description
Dynamic message type
Implementations§
source§impl MessageDescriptor
impl MessageDescriptor
sourcepub fn get_proto(&self) -> &DescriptorProto
pub fn get_proto(&self) -> &DescriptorProto
Get underlying DescriptorProto
object.
sourcepub fn for_type<M: Message>() -> &'static MessageDescriptor
pub fn for_type<M: Message>() -> &'static MessageDescriptor
Get a message descriptor for given message type
sourcepub fn new_instance(&self) -> Box<dyn Message>
pub fn new_instance(&self) -> Box<dyn Message>
New empty message
sourcepub fn fields(&self) -> &[FieldDescriptor]
pub fn fields(&self) -> &[FieldDescriptor]
Message field descriptors.
sourcepub fn get_field_by_name<'a>(
&'a self,
name: &str
) -> Option<&'a FieldDescriptor>
pub fn get_field_by_name<'a>( &'a self, name: &str ) -> Option<&'a FieldDescriptor>
Find message field by protobuf field name
Note: protobuf field name might be different for Rust field name.
sourcepub fn get_field_by_name_or_json_name<'a>(
&'a self,
name: &str
) -> Option<&'a FieldDescriptor>
pub fn get_field_by_name_or_json_name<'a>( &'a self, name: &str ) -> Option<&'a FieldDescriptor>
Find message field by field name or field JSON name
sourcepub fn get_field_by_number(&self, number: u32) -> Option<&FieldDescriptor>
pub fn get_field_by_number(&self, number: u32) -> Option<&FieldDescriptor>
Find message field by field name
sourcepub fn field_by_name<'a>(&'a self, name: &str) -> &'a FieldDescriptor
pub fn field_by_name<'a>(&'a self, name: &str) -> &'a FieldDescriptor
Find field by name
sourcepub fn field_by_number<'a>(&'a self, number: u32) -> &'a FieldDescriptor
pub fn field_by_number<'a>(&'a self, number: u32) -> &'a FieldDescriptor
Find field by number
Auto Trait Implementations§
impl !RefUnwindSafe for MessageDescriptor
impl !Send for MessageDescriptor
impl Sync for MessageDescriptor
impl Unpin for MessageDescriptor
impl !UnwindSafe for MessageDescriptor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more