Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,26 @@ impl Descriptors {
self.messages_by_name.get(name).map(|m| &self.messages[m.0])
}

/// Iterates over the messages in the descriptor set.
///
/// The order of iteration is unspecified.
pub fn iter_messages(&self) -> impl Iterator<Item = &MessageDescriptor> {
self.messages.iter()
}

/// Looks up an enum by its fully qualified name (i.e. `.foo.package.Enum`).
#[inline]
pub fn enum_by_name(&self, name: &str) -> Option<&EnumDescriptor> {
self.enums_by_name.get(name).map(|e| &self.enums[e.0])
}

/// Iterates over the enums in the descriptor set.
///
/// The order of iteration is unspecified.
pub fn iter_enums(&self) -> impl Iterator<Item = &EnumDescriptor> {
self.enums.iter()
}

/// Adds all types defined in the specified protocol buffer file descriptor set to this
/// registry.
pub fn add_file_set_proto(&mut self, file_set_proto: &descriptor::FileDescriptorSet) {
Expand Down