mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-13 14:12:31 +00:00
Add mutable getter methods for all file tags
This commit is contained in:
parent
4394d9bf8f
commit
adb8db9dde
8 changed files with 85 additions and 0 deletions
|
@ -58,15 +58,33 @@ impl ApeFile {
|
|||
self.id3v2.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v2")]
|
||||
/// Returns a mutable reference to the ID3v2 tag if it exists
|
||||
pub fn id3v2_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.id3v2.as_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v1")]
|
||||
/// Returns a reference to the ID3v1 tag if it exists
|
||||
pub fn id3v1_tag(&self) -> Option<&Tag> {
|
||||
self.id3v1.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v1")]
|
||||
/// Returns a mutable reference to the ID3v1 tag if it exists
|
||||
pub fn id3v1_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.id3v1.as_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "ape")]
|
||||
/// Returns a reference to the APEv1/2 tag if it exists
|
||||
pub fn ape_tag(&self) -> Option<&Tag> {
|
||||
self.ape.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "ape")]
|
||||
/// Returns a mutable reference to the APEv1/2 tag if it exists
|
||||
pub fn ape_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.ape.as_mut()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,21 @@ impl AiffFile {
|
|||
self.id3v2.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v2")]
|
||||
/// Returns a mutable reference to the ID3v2 tag if it exists
|
||||
pub fn id3v2_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.id3v2.as_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "aiff_text_chunks")]
|
||||
/// Returns a reference to the text chunks tag if it exists
|
||||
pub fn text_chunks(&self) -> Option<&Tag> {
|
||||
self.text_chunks.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "aiff_text_chunks")]
|
||||
/// Returns a mutable reference to the text chunks tag if it exists
|
||||
pub fn text_chunks_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.text_chunks.as_mut()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,21 @@ impl WavFile {
|
|||
self.id3v2.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v2")]
|
||||
/// Returns a mutable reference to the ID3v2 tag if it exists
|
||||
pub fn id3v2_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.id3v2.as_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "riff_info_list")]
|
||||
/// Returns a reference to the RIFF INFO tag if it exists
|
||||
pub fn riff_info(&self) -> Option<&Tag> {
|
||||
self.riff_info.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "riff_info_list")]
|
||||
/// Returns a mutable reference to the RIFF INFO tag if it exists
|
||||
pub fn riff_info_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.riff_info.as_mut()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,9 +50,16 @@ impl Mp4File {
|
|||
pub fn ftyp(&self) -> &str {
|
||||
self.ftyp.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "mp4_atoms")]
|
||||
/// Returns a reference to the "ilst" tag if it exists
|
||||
pub fn ilst(&self) -> Option<&Tag> {
|
||||
self.ilst.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "mp4_atoms")]
|
||||
/// Returns a mutable reference to the "ilst" tag if it exists
|
||||
pub fn ilst_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.ilst.as_mut()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,15 +55,33 @@ impl MpegFile {
|
|||
self.id3v2.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v2")]
|
||||
/// Returns a mutable reference to the ID3v2 tag if it exists
|
||||
pub fn id3v2_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.id3v2.as_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v1")]
|
||||
/// Returns a reference to the ID3v1 tag if it exists
|
||||
pub fn id3v1_tag(&self) -> Option<&Tag> {
|
||||
self.id3v1.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "id3v1")]
|
||||
/// Returns a mutable reference to the ID3v1 tag if it exists
|
||||
pub fn id3v1_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.id3v1.as_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "ape")]
|
||||
/// Returns a reference to the APEv1/2 tag if it exists
|
||||
pub fn ape_tag(&self) -> Option<&Tag> {
|
||||
self.ape.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "ape")]
|
||||
/// Returns a mutable reference to the APEv1/2 tag if it exists
|
||||
pub fn ape_tag_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.ape.as_mut()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,10 @@ impl FlacFile {
|
|||
pub fn vorbis_comments(&self) -> Option<&Tag> {
|
||||
self.vorbis_comments.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(feature = "vorbis_comments")]
|
||||
/// Returns a mutable reference to the Vorbis comments tag if it exists
|
||||
pub fn vorbis_comments_mut(&mut self) -> Option<&mut Tag> {
|
||||
self.vorbis_comments.as_mut()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,4 +61,10 @@ impl OpusFile {
|
|||
pub fn vorbis_comments(&self) -> &Tag {
|
||||
&self.vorbis_comments
|
||||
}
|
||||
|
||||
#[cfg(feature = "vorbis_comments")]
|
||||
/// Returns a mutable reference to the Vorbis comments tag
|
||||
pub fn vorbis_comments_mut(&mut self) -> &mut Tag {
|
||||
&mut self.vorbis_comments
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,4 +62,10 @@ impl VorbisFile {
|
|||
pub fn vorbis_comments(&self) -> &Tag {
|
||||
&self.vorbis_comments
|
||||
}
|
||||
|
||||
#[cfg(feature = "vorbis_comments")]
|
||||
/// Returns a mutable reference to the Vorbis comments tag
|
||||
pub fn vorbis_comments_mut(&mut self) -> &mut Tag {
|
||||
&mut self.vorbis_comments
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue