Skip to content

Commit

Permalink
Merge #62
Browse files Browse the repository at this point in the history
62: Add mutable slice variants of all slice-returning methods. r=frewsxcv a=frewsxcv
  • Loading branch information
bors[bot] committed Sep 10, 2017
2 parents 362b650 + 4500d76 commit ac6ea2c
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ impl Channel {
&self.categories
}

/// Return a mutable slice of the categories that this channel belongs to.
pub fn categories_mut(&mut self) -> &mut [Category] {
&mut self.categories
}

/// Set the categories that this channel belongs to.
///
/// # Examples
Expand Down Expand Up @@ -631,6 +636,11 @@ impl Channel {
&self.skip_hours
}

/// Return a mutable slice of the hours that aggregators can skip for refreshing content.
pub fn skip_hours_mut(&mut self) -> &mut [String] {
&mut self.skip_hours
}

/// Set the hours that aggregators can skip for refreshing content.
///
/// # Examples
Expand Down Expand Up @@ -663,6 +673,11 @@ impl Channel {
&self.skip_days
}

/// Return a mutable slice of the days that aggregators can skip for refreshing content.
pub fn skip_days_mut(&mut self) -> &mut [String] {
&mut self.skip_days
}

/// Set the days that aggregators can skip for refreshing content.
///
/// # Examples
Expand Down Expand Up @@ -695,6 +710,11 @@ impl Channel {
&self.items
}

/// Return a mutable slice of the items in this channel.
pub fn items_mut(&mut self) -> &mut [Item] {
&mut self.items
}

/// Set the items in this channel.
///
/// # Examples
Expand Down
78 changes: 78 additions & 0 deletions src/extension/dublincore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ impl DublinCoreExtension {
&self.contributors
}

/// Return a mutable slice of the contributors to the resource.
pub fn contributors_mut(&mut self) -> &mut [String] {
&mut self.contributors
}

/// Set the contributors to the resource.
pub fn set_contributors<V>(&mut self, contributors: V)
where
Expand All @@ -76,6 +81,12 @@ impl DublinCoreExtension {
&self.coverages
}

/// Return a mutable slice of the spatial or temporal topics of the resource, the spatial
/// applicabilities of the resource, or the jurisdictions under which the resource is relevant.
pub fn coverages_mut(&mut self) -> &mut [String] {
&mut self.coverages
}

/// Set the spatial or temporal topics of the resource, the spatial applicabilities of the
/// resource, or the jurisdictions under which the resource is relevant.
pub fn set_coverages<V>(&mut self, coverages: V)
Expand All @@ -90,6 +101,11 @@ impl DublinCoreExtension {
&self.creators
}

/// Return a mutable slice of the creators of the resource.
pub fn creators_mut(&mut self) -> &mut [String] {
&mut self.creators
}

/// Set the creators of the resource.
pub fn set_creators<V>(&mut self, creators: V)
where
Expand All @@ -103,6 +119,11 @@ impl DublinCoreExtension {
&self.dates
}

/// Return a mutable slice of the times associated with the resource.
pub fn dates_mut(&mut self) -> &mut [String] {
&mut self.dates
}

/// Set the times associated with the resource.
pub fn set_dates<V>(&mut self, dates: V)
where
Expand All @@ -116,6 +137,11 @@ impl DublinCoreExtension {
&self.descriptions
}

/// Return a mutable slice of the descriptions of the resource.
pub fn descriptions_mut(&mut self) -> &mut [String] {
&mut self.descriptions
}

/// Set the descriptions of the resource.
pub fn set_descriptions<V>(&mut self, descriptions: V)
where
Expand All @@ -129,6 +155,12 @@ impl DublinCoreExtension {
&self.formats
}

/// Return a mutable slice of the file formats, physical mediums, or
/// dimensions of the resource.
pub fn formats_mut(&mut self) -> &mut [String] {
&mut self.formats
}

/// Set the file formats, physical mediums, or dimensions of the resource.
pub fn set_formats<V>(&mut self, formats: V)
where
Expand All @@ -142,6 +174,11 @@ impl DublinCoreExtension {
&self.identifiers
}

/// Return a mutable slice of the identifiers of the resource.
pub fn identifiers_mut(&mut self) -> &mut [String] {
&mut self.identifiers
}

/// Set the identifiers of the resource.
pub fn set_identifiers<V>(&mut self, identifiers: V)
where
Expand All @@ -155,6 +192,11 @@ impl DublinCoreExtension {
&self.languages
}

/// Return a mutable slice of the languages of the resource.
pub fn languages_mut(&mut self) -> &mut [String] {
&mut self.languages
}

/// Set the languages of the resource.
pub fn set_languages<V>(&mut self, languages: V)
where
Expand All @@ -168,6 +210,11 @@ impl DublinCoreExtension {
&self.publishers
}

/// Return a mutable slice of the publishers of the resource.
pub fn publishers_mut(&mut self) -> &mut [String] {
&mut self.publishers
}

/// Set the publishers of the resource.
pub fn set_publishers<V>(&mut self, publishers: V)
where
Expand All @@ -181,6 +228,11 @@ impl DublinCoreExtension {
&self.relations
}

/// Return a mutable slice of the related resources.
pub fn relations_mut(&mut self) -> &mut [String] {
&mut self.relations
}

/// Set the related resources.
pub fn set_relations<V>(&mut self, relations: V)
where
Expand All @@ -194,6 +246,12 @@ impl DublinCoreExtension {
&self.rights
}

/// Return a mutable slice of the information about rights held in and over
/// the resource.
pub fn rights_mut(&mut self) -> &mut [String] {
&mut self.rights
}

/// Set the information about rights held in and over the resource.
pub fn set_rights<V>(&mut self, rights: V)
where
Expand All @@ -207,6 +265,11 @@ impl DublinCoreExtension {
&self.sources
}

/// Return a mutable slice of the sources of the resource.
pub fn sources_mut(&mut self) -> &mut [String] {
&mut self.sources
}

/// Set the sources of the resource.
pub fn set_sources<V>(&mut self, sources: V)
where
Expand All @@ -220,6 +283,11 @@ impl DublinCoreExtension {
&self.subjects
}

/// Return a mutable slice of the subjects of the resource.
pub fn subjects_mut(&mut self) -> &mut [String] {
&mut self.subjects
}

/// Set the topics of the resource.
pub fn set_subjects<V>(&mut self, subjects: V)
where
Expand All @@ -233,6 +301,11 @@ impl DublinCoreExtension {
&self.titles
}

/// Return a mutable slice of the titles of the resource.
pub fn titles_mut(&mut self) -> &mut [String] {
&mut self.titles
}

/// Set the titles of the resource.
pub fn set_titles<V>(&mut self, titles: V)
where
Expand All @@ -246,6 +319,11 @@ impl DublinCoreExtension {
&self.types
}

/// Return a mutable slice of the natures or genres of the resource.
pub fn types_mut(&mut self) -> &mut [String] {
&mut self.types
}

/// set the natures or genres of the resource.
pub fn set_types<V>(&mut self, types: V)
where
Expand Down
5 changes: 5 additions & 0 deletions src/extension/itunes/itunes_channel_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ impl ITunesChannelExtension {
&self.categories
}

/// Return a mutable slice of the iTunes categories that the podcast belongs to.
pub fn categories_mut(&mut self) -> &mut [ITunesCategory] {
&mut self.categories
}

/// Set the iTunes categories that the podcast belongs to.
///
/// # Examples
Expand Down
5 changes: 5 additions & 0 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ impl Item {
&self.categories
}

/// Return a mutable slice of the categories that this item belongs to.
pub fn categories_mut(&mut self) -> &mut [Category] {
&mut self.categories
}

/// Set the categories that this item belongs to.
///
/// # Examples
Expand Down

0 comments on commit ac6ea2c

Please sign in to comment.