pub trait Accessor {
fn artist(&self) -> Option<&str> { ... }
fn set_artist(&mut self, _value: String) { ... }
fn remove_artist(&mut self) { ... }
fn title(&self) -> Option<&str> { ... }
fn set_title(&mut self, _value: String) { ... }
fn remove_title(&mut self) { ... }
fn album(&self) -> Option<&str> { ... }
fn set_album(&mut self, _value: String) { ... }
fn remove_album(&mut self) { ... }
fn genre(&self) -> Option<&str> { ... }
fn set_genre(&mut self, _value: String) { ... }
fn remove_genre(&mut self) { ... }
}
Expand description
Provides accessors for common items
This attempts to only provide methods for items that all tags have in common, but there may be exceptions.
Provided Methods
Returns the artist
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
assert_eq!(tag.artist(), None);
fn set_artist(&mut self, _value: String)
fn set_artist(&mut self, _value: String)
Sets the artist
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_artist(String::from("Foo artist"));
assert_eq!(tag.artist(), Some("Foo artist"));
fn remove_artist(&mut self)
fn remove_artist(&mut self)
Removes the artist
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_artist(String::from("Foo artist"));
assert_eq!(tag.artist(), Some("Foo artist"));
tag.remove_artist();
assert_eq!(tag.artist(), None);
Returns the title
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
assert_eq!(tag.title(), None);
Sets the title
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_title(String::from("Foo title"));
assert_eq!(tag.title(), Some("Foo title"));
fn remove_title(&mut self)
fn remove_title(&mut self)
Removes the title
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_title(String::from("Foo title"));
assert_eq!(tag.title(), Some("Foo title"));
tag.remove_title();
assert_eq!(tag.title(), None);
Returns the album
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
assert_eq!(tag.album(), None);
Sets the album
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_album(String::from("Foo album"));
assert_eq!(tag.album(), Some("Foo album"));
fn remove_album(&mut self)
fn remove_album(&mut self)
Removes the album
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_album(String::from("Foo album"));
assert_eq!(tag.album(), Some("Foo album"));
tag.remove_album();
assert_eq!(tag.album(), None);
Returns the genre
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
assert_eq!(tag.genre(), None);
Sets the genre
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_genre(String::from("Foo genre"));
assert_eq!(tag.genre(), Some("Foo genre"));
fn remove_genre(&mut self)
fn remove_genre(&mut self)
Removes the genre
Example
use lofty::{Tag, Accessor};
let mut tag = Tag::new(tag_type);
tag.set_genre(String::from("Foo genre"));
assert_eq!(tag.genre(), Some("Foo genre"));
tag.remove_genre();
assert_eq!(tag.genre(), None);