Struct prost_reflect::FileDescriptor
source · pub struct FileDescriptor { /* private fields */ }
Expand description
A single source file containing protobuf messages and services.
Implementations§
source§impl FileDescriptor
impl FileDescriptor
sourcepub fn new(descriptor_pool: DescriptorPool, index: usize) -> Self
pub fn new(descriptor_pool: DescriptorPool, index: usize) -> Self
Create a new FileDescriptor
referencing the file at index
within the given DescriptorPool
.
§Panics
Panics if index
is out-of-bounds.
sourcepub fn parent_pool(&self) -> &DescriptorPool
pub fn parent_pool(&self) -> &DescriptorPool
Gets a reference to the DescriptorPool
this file is included in.
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Gets the unique name of this file relative to the root of the source tree,
e.g. path/to/my_package.proto
.
sourcepub fn package_name(&self) -> &str
pub fn package_name(&self) -> &str
Gets the name of the package specifier for a file, e.g. my.package
.
If no package name is set, an empty string is returned.
sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
Gets the index of this file within the parent DescriptorPool
.
sourcepub fn dependencies(&self) -> impl ExactSizeIterator<Item = FileDescriptor> + '_
pub fn dependencies(&self) -> impl ExactSizeIterator<Item = FileDescriptor> + '_
Gets the dependencies of this file.
This corresponds to the FileDescriptorProto::dependency
field.
sourcepub fn public_dependencies(
&self,
) -> impl ExactSizeIterator<Item = FileDescriptor> + '_
pub fn public_dependencies( &self, ) -> impl ExactSizeIterator<Item = FileDescriptor> + '_
Gets the public dependencies of this file.
This corresponds to the FileDescriptorProto::public_dependency
field.
sourcepub fn messages(&self) -> impl ExactSizeIterator<Item = MessageDescriptor> + '_
pub fn messages(&self) -> impl ExactSizeIterator<Item = MessageDescriptor> + '_
Gets the top-level message types defined within this file.
This does not include nested messages defined within another message.
sourcepub fn enums(&self) -> impl ExactSizeIterator<Item = EnumDescriptor> + '_
pub fn enums(&self) -> impl ExactSizeIterator<Item = EnumDescriptor> + '_
Gets the top-level enum types defined within this file.
This does not include nested enums defined within another message.
sourcepub fn extensions(
&self,
) -> impl ExactSizeIterator<Item = ExtensionDescriptor> + '_
pub fn extensions( &self, ) -> impl ExactSizeIterator<Item = ExtensionDescriptor> + '_
Gets the top-level extension fields defined within this file.
This does not include nested extensions defined within another message.
sourcepub fn services(&self) -> impl ExactSizeIterator<Item = ServiceDescriptor> + '_
pub fn services(&self) -> impl ExactSizeIterator<Item = ServiceDescriptor> + '_
Gets the services defined within this file.
sourcepub fn file_descriptor_proto(&self) -> &FileDescriptorProto
pub fn file_descriptor_proto(&self) -> &FileDescriptorProto
Gets a reference to the raw FileDescriptorProto
wrapped by this FileDescriptor
.
sourcepub fn encode<B>(&self, buf: B) -> Result<(), EncodeError>where
B: BufMut,
pub fn encode<B>(&self, buf: B) -> Result<(), EncodeError>where
B: BufMut,
Encodes this file descriptor to its byte representation.
The encoded message is equivalent to a FileDescriptorProto
, however also includes
any extension options that were defined.
sourcepub fn encode_to_vec(&self) -> Vec<u8>
pub fn encode_to_vec(&self) -> Vec<u8>
Encodes this file descriptor to a newly allocated buffer.
The encoded message is equivalent to a FileDescriptorProto
, however also includes
any extension options that were defined.
sourcepub fn options(&self) -> DynamicMessage
pub fn options(&self) -> DynamicMessage
Decodes the options defined for this FileDescriptor
, including any extension options.
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 moresource§impl Debug for FileDescriptor
impl Debug for FileDescriptor
source§impl PartialEq for FileDescriptor
impl PartialEq for FileDescriptor
impl Eq for FileDescriptor
impl StructuralPartialEq for FileDescriptor
Auto Trait Implementations§
impl Freeze for FileDescriptor
impl RefUnwindSafe for FileDescriptor
impl Send for FileDescriptor
impl Sync for FileDescriptor
impl Unpin for FileDescriptor
impl UnwindSafe for FileDescriptor
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)