pub struct FileDescriptor { /* private fields */ }
Expand description
Reflection for objects defined in .proto
file (messages, enums, etc).
The object is refcounted: clone is shallow.
The equality performs pointer comparison: two clones of the same FileDescriptor
objects are equal, but two FileDescriptor
objects created from the same FileDescriptorProto
objects are not equal.
Implementations§
Source§impl FileDescriptor
impl FileDescriptor
Sourcepub fn messages(&self) -> impl Iterator<Item = MessageDescriptor> + '_
pub fn messages(&self) -> impl Iterator<Item = MessageDescriptor> + '_
Top-level messages.
Sourcepub fn enums(&self) -> impl Iterator<Item = EnumDescriptor> + '_
pub fn enums(&self) -> impl Iterator<Item = EnumDescriptor> + '_
Get top-level enums.
Sourcepub fn services(&self) -> impl Iterator<Item = ServiceDescriptor> + '_
pub fn services(&self) -> impl Iterator<Item = ServiceDescriptor> + '_
Get services defined in .proto
file.
Sourcepub fn extensions(&self) -> impl Iterator<Item = FieldDescriptor> + '_
pub fn extensions(&self) -> impl Iterator<Item = FieldDescriptor> + '_
Extension fields.
Sourcepub fn message_by_package_relative_name(
&self,
name: &str,
) -> Option<MessageDescriptor>
pub fn message_by_package_relative_name( &self, name: &str, ) -> Option<MessageDescriptor>
Find message by name relative to the package.
Only search in the current file, not in any dependencies.
Sourcepub fn enum_by_package_relative_name(
&self,
name: &str,
) -> Option<EnumDescriptor>
pub fn enum_by_package_relative_name( &self, name: &str, ) -> Option<EnumDescriptor>
Find message by name relative to the package.
Only search in the current file, not in any dependencies.
Sourcepub fn message_by_full_name(&self, name: &str) -> Option<MessageDescriptor>
pub fn message_by_full_name(&self, name: &str) -> Option<MessageDescriptor>
Find message by fully-qualified name.
Only search in the current file, not in any dependencies.
Sourcepub fn enum_by_full_name(&self, name: &str) -> Option<EnumDescriptor>
pub fn enum_by_full_name(&self, name: &str) -> Option<EnumDescriptor>
Find enum by name fully-qualified name.
Only search in the current file, not in any dependencies.
Sourcepub fn new_dynamic(
proto: FileDescriptorProto,
dependencies: &[FileDescriptor],
) -> Result<FileDescriptor>
pub fn new_dynamic( proto: FileDescriptorProto, dependencies: &[FileDescriptor], ) -> Result<FileDescriptor>
Dynamic message created from FileDescriptorProto
without generated files.
Sourcepub fn new_dynamic_fds(
protos: Vec<FileDescriptorProto>,
dependencies: &[FileDescriptor],
) -> Result<Vec<FileDescriptor>>
pub fn new_dynamic_fds( protos: Vec<FileDescriptorProto>, dependencies: &[FileDescriptor], ) -> Result<Vec<FileDescriptor>>
Create a set of file descriptors from individual file descriptors.
Sourcepub fn proto(&self) -> &FileDescriptorProto
pub fn proto(&self) -> &FileDescriptorProto
.proto
data for this file.
Sourcepub fn deps(&self) -> &[FileDescriptor]
pub fn deps(&self) -> &[FileDescriptor]
Direct dependencies of this file.
Sourcepub fn public_deps(&self) -> impl Iterator<Item = FileDescriptor> + '_
pub fn public_deps(&self) -> impl Iterator<Item = FileDescriptor> + '_
Subset of dependencies which are public
Trait Implementations§
Source§impl Clone for FileDescriptor
impl Clone for FileDescriptor
Source§fn clone(&self) -> FileDescriptor
fn clone(&self) -> FileDescriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more