[][src]Struct audiotags::Tag

pub struct Tag { /* fields omitted */ }

A builder for Box<dyn AudioTag>. If you do not want a trait object, you can use individual types.

Examples

use audiotags::{Tag, TagType};
// Guess the format by default
let mut tag = Tag::new().read_from_path("assets/a.mp3").unwrap();
tag.set_title("Foo");
// you can convert the tag type and save the metadata to another file.
tag.to_dyn_tag(TagType::Mp4).write_to_path("assets/a.m4a");
// you can specify the tag type (but when you want to do this, also consider directly using the concrete type)
let tag = Tag::new().with_tag_type(TagType::Mp4).read_from_path("assets/a.m4a").unwrap();
assert_eq!(tag.title(), Some("Foo"));

Implementations

impl Tag[src]

pub fn new() -> Self[src]

Initiate a new Tag (a builder for Box<dyn AudioTag>) with default configurations. You can then optionally chain with_tag_type and/or with_config. Finally, you read_from_path

pub fn with_tag_type(self, tag_type: TagType) -> Self[src]

Specify the tag type

pub fn with_config(self, config: Config) -> Self[src]

Specify configuration, if you do not want to use the default

pub fn read_from_path(
    &self,
    path: impl AsRef<Path>
) -> Result<Box<dyn AudioTag>>
[src]

Trait Implementations

impl Default for Tag[src]

Auto Trait Implementations

impl RefUnwindSafe for Tag

impl Send for Tag

impl Sync for Tag

impl Unpin for Tag

impl UnwindSafe for Tag

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.