pub struct ApeTag {
pub read_only: bool,
/* private fields */
}Expand description
An APE tag
Supported file types
Item storage
APE isn’t a very strict format. An ApeItem only restricted by its name, meaning it can use
a normal ItemValue unlike other formats.
Pictures are stored as ItemValue::Binary, and can be converted with
Picture::from_ape_bytes. For the appropriate item keys, see
APE_PICTURE_TYPES.
Conversions
To Tag
Any ApeItem with an ItemKey mapping will have a 1:1 conversion to TagItem.
From Tag
When converting pictures, any of type PictureType::Undefined will be discarded.
For items, see ApeItem::new.
Fields§
§read_only: boolWhether or not to mark the tag as read only
Implementations§
source§impl ApeTag
impl ApeTag
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty ApeTag
Examples
use lofty::ape::ApeTag;
use lofty::TagExt;
let ape_tag = ApeTag::new();
assert!(ape_tag.is_empty());sourcepub fn get(&self, key: &str) -> Option<&ApeItem>
pub fn get(&self, key: &str) -> Option<&ApeItem>
Get an ApeItem by key
NOTE: While APE items are supposed to be case-sensitive,
this rule is rarely followed, so this will ignore case when searching.
Examples
use lofty::ape::ApeTag;
use lofty::Accessor;
let mut ape_tag = ApeTag::new();
ape_tag.set_title(String::from("Foo title"));
// Get the title by its key
let title = ape_tag.get("Title");
assert!(title.is_some());sourcepub fn insert(&mut self, value: ApeItem)
pub fn insert(&mut self, value: ApeItem)
Insert an ApeItem
This will remove any item with the same key prior to insertion
sourcepub fn remove(&mut self, key: &str)
pub fn remove(&mut self, key: &str)
Remove an ApeItem by key
NOTE: Like ApeTag::get, this is not case-sensitive
Examples
use lofty::ape::ApeTag;
use lofty::Accessor;
let mut ape_tag = ApeTag::new();
ape_tag.set_title(String::from("Foo title"));
// Get the title by its key
let title = ape_tag.get("Title");
assert!(title.is_some());
// Remove the title
ape_tag.remove("Title");
let title = ape_tag.get("Title");
assert!(title.is_none());Trait Implementations§
source§impl Accessor for ApeTag
impl Accessor for ApeTag
source§fn set_artist(&mut self, value: String)
fn set_artist(&mut self, value: String)
source§fn remove_artist(&mut self)
fn remove_artist(&mut self)
source§fn remove_title(&mut self)
fn remove_title(&mut self)
source§fn remove_album(&mut self)
fn remove_album(&mut self)
source§fn remove_genre(&mut self)
fn remove_genre(&mut self)
source§fn set_comment(&mut self, value: String)
fn set_comment(&mut self, value: String)
source§fn remove_comment(&mut self)
fn remove_comment(&mut self)
source§fn remove_track(&mut self)
fn remove_track(&mut self)
source§fn set_track_total(&mut self, value: u32)
fn set_track_total(&mut self, value: u32)
source§fn remove_track_total(&mut self)
fn remove_track_total(&mut self)
source§fn remove_disk(&mut self)
fn remove_disk(&mut self)
source§fn set_disk_total(&mut self, value: u32)
fn set_disk_total(&mut self, value: u32)
source§fn remove_disk_total(&mut self)
fn remove_disk_total(&mut self)
source§fn remove_year(&mut self)
fn remove_year(&mut self)
source§impl<'a> IntoIterator for &'a ApeTag
impl<'a> IntoIterator for &'a ApeTag
source§impl IntoIterator for ApeTag
impl IntoIterator for ApeTag
source§impl PartialEq for ApeTag
impl PartialEq for ApeTag
source§impl TagExt for ApeTag
impl TagExt for ApeTag
source§fn save_to(&self, file: &mut File) -> Result<(), Self::Err>
fn save_to(&self, file: &mut File) -> Result<(), Self::Err>
Write an APE tag to a file
Errors
- Attempting to write the tag to a format that does not support it
- An existing tag has an invalid size