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

source

pub fn name(&self) -> &str

The file name.

source

pub fn package(&self) -> &str

Protobuf package.

source

pub fn syntax(&self) -> Syntax

Syntax of current file.

source

pub fn messages(&self) -> impl Iterator<Item = MessageDescriptor> + '_

Top-level messages.

source

pub fn enums(&self) -> impl Iterator<Item = EnumDescriptor> + '_

Get top-level enums.

source

pub fn services(&self) -> impl Iterator<Item = ServiceDescriptor> + '_

Get services defined in .proto file.

source

pub fn extensions(&self) -> impl Iterator<Item = FieldDescriptor> + '_

Extension fields.

source

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.

source

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.

source

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.

source

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.

source

pub fn new_dynamic( proto: FileDescriptorProto, dependencies: &[FileDescriptor] ) -> Result<FileDescriptor>

Dynamic message created from FileDescriptorProto without generated files.

source

pub fn new_dynamic_fds( protos: Vec<FileDescriptorProto>, dependencies: &[FileDescriptor] ) -> Result<Vec<FileDescriptor>>

Create a set of file descriptors from individual file descriptors.

source

pub fn proto(&self) -> &FileDescriptorProto

.proto data for this file.

source

pub fn deps(&self) -> &[FileDescriptor]

Direct dependencies of this file.

source

pub fn public_deps(&self) -> impl Iterator<Item = FileDescriptor> + '_

Subset of dependencies which are public

Trait Implementations§

source§

impl Clone for FileDescriptor

source§

fn clone(&self) -> FileDescriptor

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FileDescriptor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for FileDescriptor

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for FileDescriptor

source§

fn eq(&self, other: &FileDescriptor) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for FileDescriptor

source§

impl StructuralPartialEq for FileDescriptor

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.