mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +00:00
Add TaggedFile::tag and TaggedFile::tag_mut for fetching specific TagTypes
This commit is contained in:
parent
9c26533550
commit
351684caec
1 changed files with 10 additions and 0 deletions
|
@ -101,6 +101,16 @@ impl TaggedFile {
|
|||
self.tags.first_mut()
|
||||
}
|
||||
|
||||
/// Get a reference to a specific [`TagType`]
|
||||
pub fn tag(&self, tag_type: &TagType) -> Option<&Tag> {
|
||||
self.tags.iter().find(|i| i.tag_type() == tag_type)
|
||||
}
|
||||
|
||||
/// Get a mutable reference to a specific [`TagType`]
|
||||
pub fn tag_mut(&mut self, tag_type: &TagType) -> Option<&mut Tag> {
|
||||
self.tags.iter_mut().find(|i| i.tag_type() == tag_type)
|
||||
}
|
||||
|
||||
/// Returns the file's [`FileType`]
|
||||
pub fn file_type(&self) -> &FileType {
|
||||
&self.ty
|
||||
|
|
Loading…
Reference in a new issue