Skip to content

Commit

Permalink
fix(prost-build): MSRV for Context
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabaluev committed Nov 19, 2024
1 parent eba3137 commit 205a126
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions prost-build/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,29 @@ impl<'a> Context<'a> {

/// Returns an iterator over the additional attributes configured
/// for the named type.
pub fn type_attributes(&self, fq_type_name: &str) -> path::Iter<'_, String> {
self.config.type_attributes.get(fq_type_name)
pub fn type_attributes(&self, fq_type_name: &str) -> impl Iterator<Item = &str> {
self.config
.type_attributes
.get(fq_type_name)
.map(|s| s.as_str())
}

/// Returns an iterator over the additional attributes configured
/// for the named message.
pub fn message_attributes(&self, fq_message_name: &str) -> path::Iter<'_, String> {
self.config.message_attributes.get(fq_message_name)
pub fn message_attributes(&self, fq_message_name: &str) -> impl Iterator<Item = &str> {
self.config
.message_attributes
.get(fq_message_name)
.map(|s| s.as_str())
}

/// Returns an iterator over the additional attributes configured
/// for the named enum.
pub fn enum_attributes(&self, fq_enum_name: &str) -> path::Iter<'_, String> {
self.config.enum_attributes.get(fq_enum_name)
pub fn enum_attributes(&self, fq_enum_name: &str) -> impl Iterator<Item = &str> {
self.config
.enum_attributes
.get(fq_enum_name)
.map(|s| s.as_str())
}

/// Returns an iterator over the additional attributes configured
Expand Down

0 comments on commit 205a126

Please sign in to comment.