Struct ape::Tag
[−]
[src]
pub struct Tag { pub items: Vec<Item>, }
An APE Tag containing APE Tag Items.
Examples
Creating a tag
use ape::{Tag, Item}; let mut tag = Tag::new(); let item = Item::from_text("artist", "Artist Name").unwrap(); tag.set_item(item); tag.write("path/to/file").unwrap();
Updating a tag
use ape::{read, Item}; let path = "path/to/file"; let mut tag = read(path).unwrap(); let item = Item::from_text("album", "Album Name").unwrap(); tag.set_item(item); tag.remove_item("cover"); tag.write(path).unwrap();
Fields
items: Vec<Item>
A vector of items included in the tag.
Methods
impl Tag
[src]
fn new() -> Tag
Creates a new empty tag.
fn item(&self, key: &str) -> Option<&Item>
Returns an item by key.
fn set_item(&mut self, item: Item)
Sets a new item.
If there is an item with the same key, it will be removed.
fn remove_item(&mut self, key: &str) -> bool
Removes an item by key.
Returns true, if item was removed, and false otherwise.
fn write<P: AsRef<Path>>(&self, path: P) -> Result<()>
Attempts to write the APE Tag to the file at the specified path.
Errors
It is considered an error if there are no items in the tag.