pub struct Tag(_);
Expand description
An APE Tag containing APE Tag Items.
Examples
Creating a tag
use ape::{Item, Tag, write_to_path};
let mut tag = Tag::new();
let item = Item::from_text("artist", "Artist Name").unwrap();
tag.set_item(item);
write_to_path(&tag, "path/to/file").unwrap();
Updating a tag
use ape::{Item, read_from_path, write_to_path};
let path = "path/to/file";
let mut tag = read_from_path(path).unwrap();
let item = Item::from_text("album", "Album Name").unwrap();
tag.set_item(item);
tag.remove_items("cover");
write_to_path(&tag, path).unwrap();
Implementations§
source§impl Tag
impl Tag
sourcepub fn set_item(&mut self, item: Item)
pub fn set_item(&mut self, item: Item)
Sets a new item.
If there is an item with the same key, it will be removed.
sourcepub fn add_item(&mut self, item: Item)
pub fn add_item(&mut self, item: Item)
Adds a new item.
Unlike set_item
, existing items with the same key are not removed.
sourcepub fn remove_items(&mut self, key: &str) -> usize
pub fn remove_items(&mut self, key: &str) -> usize
Removes all items by key.
Returns a number of deleted items