Struct mp4ameta::Tag [−][src]
A MPEG-4 audio tag containing metadata atoms
Fields
ftyp: StringThe ftyp atom.
info: AudioInfoReadonly audio information
atoms: Vec<AtomData>A vector containing metadata atoms
Implementations
impl Tag[src]
impl Tag[src]pub fn standard_genres(&self) -> impl Iterator<Item = u16> + '_[src]
Returns all standard genres (gnre).
pub fn standard_genre(&self) -> Option<u16>[src]
Returns the first standard genre (gnre).
pub fn set_standard_genre(&mut self, genre_code: u16)[src]
Sets the standard genre (gnre). This will remove all other standard genres.
pub fn add_standard_genre(&mut self, genre_code: u16)[src]
Adds a standard genre (gnre).
pub fn remove_standard_genres(&mut self)[src]
Removes all standard genres (gnre).
impl Tag[src]
impl Tag[src]Genre
These are convenience methods that operate on values of both standard genres (gnre) and
custom genres (©gen).
pub fn genres(&self) -> impl Iterator<Item = &str> + '_[src]
Returns all genres, first the standard genres (gnre) then custom ones (©gen).
pub fn genre(&self) -> Option<&str>[src]
Returns the first genre (gnre or ©gen).
pub fn take_genres(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes all custom genres (©gen) and returns all genres, first standard genres (gnre)
then custom ones (©gen).
pub fn take_genre(&mut self) -> Option<String>[src]
Consumes all custom genres (©gen) and returns the first genre (gnre or ©gen).
pub fn set_genre(&mut self, genre: impl Into<String>)[src]
Sets the standard genre (gnre) if it matches a predefined value otherwise a custom genre
(©gen). This will remove all other standard or custom genres.
pub fn add_genre(&mut self, genre: impl Into<String>)[src]
Adds a standard genre (gnre) if it matches a predefined value otherwise a custom genre
(©gen).
pub fn remove_genres(&mut self)[src]
Removes the genre (gnre or ©gen).
impl Tag[src]
impl Tag[src]pub fn duration(&self) -> Option<Duration>[src]
Returns the duration in seconds.
pub fn channel_config(&self) -> Option<ChannelConfig>[src]
Returns the channel configuration.
pub fn sample_rate(&self) -> Option<SampleRate>[src]
Returns the channel configuration.
pub fn avg_bitrate(&self) -> Option<u32>[src]
Returns the average bitrate.
pub fn max_bitrate(&self) -> Option<u32>[src]
Returns the maximum bitrate.
impl Tag[src]
impl Tag[src]Track
The track number and total number of tracks are stored in a tuple. If only one is present the other is represented as 0 and will be treated as if nonexistent.
pub fn track(&self) -> (Option<u16>, Option<u16>)[src]
Returns the track number and the total number of tracks (trkn).
pub fn track_number(&self) -> Option<u16>[src]
Returns the track number (trkn).
pub fn total_tracks(&self) -> Option<u16>[src]
Returns the total number of tracks (trkn).
pub fn set_track(&mut self, track_number: u16, total_tracks: u16)[src]
Sets the track number and the total number of tracks (trkn).
pub fn set_track_number(&mut self, track_number: u16)[src]
Sets the track number (trkn).
pub fn set_total_tracks(&mut self, total_tracks: u16)[src]
Sets the total number of tracks (trkn).
pub fn remove_track(&mut self)[src]
Removes the track number and the total number of tracks (trkn).
pub fn remove_track_number(&mut self)[src]
Removes the track number, preserving the total number of tracks if present (trkn).
pub fn remove_total_tracks(&mut self)[src]
Removes the total number of tracks, preserving the track number if present (trkn).
impl Tag[src]
impl Tag[src]Disc
The disc number and total number of discs are stored in a tuple. If only one is present the other is represented as 0 and will be treated as if nonexistent.
pub fn disc(&self) -> (Option<u16>, Option<u16>)[src]
Returns the disc number and total number of discs (disk).
pub fn disc_number(&self) -> Option<u16>[src]
Returns the disc number (disk).
pub fn total_discs(&self) -> Option<u16>[src]
Returns the total number of discs (disk).
pub fn set_disc(&mut self, disc_number: u16, total_discs: u16)[src]
Sets the disc number and the total number of discs (disk).
pub fn set_disc_number(&mut self, disc_number: u16)[src]
Sets the disc number (disk).
pub fn set_total_discs(&mut self, total_discs: u16)[src]
Sets the total number of discs (disk).
pub fn remove_disc(&mut self)[src]
Removes the disc number and the total number of discs (disk).
pub fn remove_disc_number(&mut self)[src]
Removes the disc number, preserving the total number of discs if present (disk).
pub fn remove_total_discs(&mut self)[src]
Removes the total number of discs, preserving the disc number if present (disk).
impl Tag[src]
impl Tag[src]pub const fn new(ftyp: String, info: AudioInfo, atoms: Vec<AtomData>) -> Self[src]
Creates a new MPEG-4 audio tag containing the atom.
pub fn read_from(reader: &mut impl Read + Seek) -> Result<Self>[src]
Attempts to read a MPEG-4 audio tag from the reader.
pub fn read_from_path(path: impl AsRef<Path>) -> Result<Self>[src]
Attempts to read a MPEG-4 audio tag from the file at the indicated path.
pub fn write_to(&self, file: &File) -> Result<()>[src]
Attempts to write the MPEG-4 audio tag to the writer. This will overwrite any metadata previously present on the file.
pub fn write_to_path(&self, path: impl AsRef<Path>) -> Result<()>[src]
Attempts to write the MPEG-4 audio tag to the path. This will overwrite any metadata previously present on the file.
pub fn dump_to(&self, writer: &mut impl Write) -> Result<()>[src]
Attempts to dump the MPEG-4 audio tag to the writer.
pub fn dump_to_path(&self, path: impl AsRef<Path>) -> Result<()>[src]
Attempts to dump the MPEG-4 audio tag to the writer.
impl Tag[src]
impl Tag[src]pub fn copyright(&self) -> Option<&str>[src]
Returns the copyright (cprt).
pub fn take_copyright(&mut self) -> Option<String>[src]
Consumes and returns the copyright (cprt).
pub fn set_copyright(&mut self, copyright: impl Into<String>)[src]
Sets the copyright (cprt).
pub fn remove_copyright(&mut self)[src]
Removes the copyright (cprt).
impl Tag[src]
impl Tag[src]pub fn encoder(&self) -> Option<&str>[src]
Returns the encoder (©too).
pub fn take_encoder(&mut self) -> Option<String>[src]
Consumes and returns the encoder (©too).
pub fn set_encoder(&mut self, encoder: impl Into<String>)[src]
Sets the encoder (©too).
pub fn remove_encoder(&mut self)[src]
Removes the encoder (©too).
impl Tag[src]
impl Tag[src]pub fn lyrics(&self) -> Option<&str>[src]
Returns the lyrics (©lyr).
pub fn take_lyrics(&mut self) -> Option<String>[src]
Consumes and returns the lyrics (©lyr).
pub fn set_lyrics(&mut self, lyrics: impl Into<String>)[src]
Sets the lyrics (©lyr).
pub fn remove_lyrics(&mut self)[src]
Removes the lyrics (©lyr).
impl Tag[src]
impl Tag[src]pub fn movement(&self) -> Option<&str>[src]
Returns the movement (©mvn).
pub fn take_movement(&mut self) -> Option<String>[src]
Consumes and returns the movement (©mvn).
pub fn set_movement(&mut self, movement: impl Into<String>)[src]
Sets the movement (©mvn).
pub fn remove_movement(&mut self)[src]
Removes the movement (©mvn).
impl Tag[src]
impl Tag[src]pub fn tv_episode_name(&self) -> Option<&str>[src]
Returns the tv episode name (tven).
pub fn take_tv_episode_name(&mut self) -> Option<String>[src]
Consumes and returns the tv episode name (tven).
pub fn set_tv_episode_name(&mut self, tv_episode_name: impl Into<String>)[src]
Sets the tv episode name (tven).
pub fn remove_tv_episode_name(&mut self)[src]
Removes the tv episode name (tven).
impl Tag[src]
impl Tag[src]pub fn tv_network_name(&self) -> Option<&str>[src]
Returns the tv network name (tvnn).
pub fn take_tv_network_name(&mut self) -> Option<String>[src]
Consumes and returns the tv network name (tvnn).
pub fn set_tv_network_name(&mut self, tv_network_name: impl Into<String>)[src]
Sets the tv network name (tvnn).
pub fn remove_tv_network_name(&mut self)[src]
Removes the tv network name (tvnn).
impl Tag[src]
impl Tag[src]pub fn tv_show_name(&self) -> Option<&str>[src]
Returns the tv show name (tvsh).
pub fn take_tv_show_name(&mut self) -> Option<String>[src]
Consumes and returns the tv show name (tvsh).
pub fn set_tv_show_name(&mut self, tv_show_name: impl Into<String>)[src]
Sets the tv show name (tvsh).
pub fn remove_tv_show_name(&mut self)[src]
Removes the tv show name (tvsh).
impl Tag[src]
impl Tag[src]pub fn isrc(&self) -> Option<&str>[src]
Returns the isrc (----:com.apple.iTunes:ISRC).
pub fn take_isrc(&mut self) -> Option<String>[src]
Consumes and returns the isrc (----:com.apple.iTunes:ISRC).
pub fn set_isrc(&mut self, isrc: impl Into<String>)[src]
Sets the isrc (----:com.apple.iTunes:ISRC).
pub fn remove_isrc(&mut self)[src]
Removes the isrc (----:com.apple.iTunes:ISRC).
impl Tag[src]
impl Tag[src]pub fn album_artists(&self) -> impl Iterator<Item = &str>[src]
Returns all album artists (aART).
pub fn album_artist(&self) -> Option<&str>[src]
Returns the first album artist (aART).
pub fn take_album_artists(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all album artists (aART).
pub fn take_album_artist(&mut self) -> Option<String>[src]
Consumes all and returns the first album artist (aART).
pub fn set_album_artist(&mut self, album_artist: impl Into<String>)[src]
Sets the album artist (aART). This will remove all other album artists.
pub fn add_album_artist(&mut self, album_artist: impl Into<String>)[src]
Adds an album artist (aART).
pub fn remove_album_artists(&mut self)[src]
Removes all album artists (aART).
impl Tag[src]
impl Tag[src]pub fn artists(&self) -> impl Iterator<Item = &str>[src]
Returns all artists (©ART).
pub fn artist(&self) -> Option<&str>[src]
Returns the first artist (©ART).
pub fn take_artists(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all artists (©ART).
pub fn take_artist(&mut self) -> Option<String>[src]
Consumes all and returns the first artist (©ART).
pub fn set_artist(&mut self, artist: impl Into<String>)[src]
Sets the artist (©ART). This will remove all other artists.
pub fn add_artist(&mut self, artist: impl Into<String>)[src]
Adds an artist (©ART).
pub fn remove_artists(&mut self)[src]
Removes all artists (©ART).
impl Tag[src]
impl Tag[src]pub fn categories(&self) -> impl Iterator<Item = &str>[src]
Returns all categories (catg).
pub fn category(&self) -> Option<&str>[src]
Returns the first category (catg).
pub fn take_categories(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all categories (catg).
pub fn take_category(&mut self) -> Option<String>[src]
Consumes all and returns the first category (catg).
pub fn set_category(&mut self, category: impl Into<String>)[src]
Sets the category (catg). This will remove all other categories.
pub fn add_category(&mut self, category: impl Into<String>)[src]
Adds an category (catg).
pub fn remove_categories(&mut self)[src]
Removes all categories (catg).
impl Tag[src]
impl Tag[src]pub fn comments(&self) -> impl Iterator<Item = &str>[src]
Returns all comments (©cmt).
pub fn comment(&self) -> Option<&str>[src]
Returns the first comment (©cmt).
pub fn take_comments(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all comments (©cmt).
pub fn take_comment(&mut self) -> Option<String>[src]
Consumes all and returns the first comment (©cmt).
pub fn set_comment(&mut self, comment: impl Into<String>)[src]
Sets the comment (©cmt). This will remove all other comments.
pub fn add_comment(&mut self, comment: impl Into<String>)[src]
Adds an comment (©cmt).
pub fn remove_comments(&mut self)[src]
Removes all comments (©cmt).
impl Tag[src]
impl Tag[src]pub fn composers(&self) -> impl Iterator<Item = &str>[src]
Returns all composers (©wrt).
pub fn composer(&self) -> Option<&str>[src]
Returns the first composer (©wrt).
pub fn take_composers(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all composers (©wrt).
pub fn take_composer(&mut self) -> Option<String>[src]
Consumes all and returns the first composer (©wrt).
pub fn set_composer(&mut self, composer: impl Into<String>)[src]
Sets the composer (©wrt). This will remove all other composers.
pub fn add_composer(&mut self, composer: impl Into<String>)[src]
Adds an composer (©wrt).
pub fn remove_composers(&mut self)[src]
Removes all composers (©wrt).
impl Tag[src]
impl Tag[src]pub fn custom_genres(&self) -> impl Iterator<Item = &str>[src]
Returns all custom genres (©gen).
pub fn custom_genre(&self) -> Option<&str>[src]
Returns the first custom genre (©gen).
pub fn take_custom_genres(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all custom genres (©gen).
pub fn take_custom_genre(&mut self) -> Option<String>[src]
Consumes all and returns the first custom genre (©gen).
pub fn set_custom_genre(&mut self, custom_genre: impl Into<String>)[src]
Sets the custom genre (©gen). This will remove all other custom genres.
pub fn add_custom_genre(&mut self, custom_genre: impl Into<String>)[src]
Adds an custom genre (©gen).
pub fn remove_custom_genres(&mut self)[src]
Removes all custom genres (©gen).
impl Tag[src]
impl Tag[src]pub fn descriptions(&self) -> impl Iterator<Item = &str>[src]
Returns all descriptions (desc).
pub fn description(&self) -> Option<&str>[src]
Returns the first description (desc).
pub fn take_descriptions(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all descriptions (desc).
pub fn take_description(&mut self) -> Option<String>[src]
Consumes all and returns the first description (desc).
pub fn set_description(&mut self, description: impl Into<String>)[src]
Sets the description (desc). This will remove all other descriptions.
pub fn add_description(&mut self, description: impl Into<String>)[src]
Adds an description (desc).
pub fn remove_descriptions(&mut self)[src]
Removes all descriptions (desc).
impl Tag[src]
impl Tag[src]pub fn groupings(&self) -> impl Iterator<Item = &str>[src]
Returns all groupings (©grp).
pub fn grouping(&self) -> Option<&str>[src]
Returns the first grouping (©grp).
pub fn take_groupings(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all groupings (©grp).
pub fn take_grouping(&mut self) -> Option<String>[src]
Consumes all and returns the first grouping (©grp).
pub fn set_grouping(&mut self, grouping: impl Into<String>)[src]
Sets the grouping (©grp). This will remove all other groupings.
pub fn add_grouping(&mut self, grouping: impl Into<String>)[src]
Adds an grouping (©grp).
pub fn remove_groupings(&mut self)[src]
Removes all groupings (©grp).
impl Tag[src]
impl Tag[src]pub fn keywords(&self) -> impl Iterator<Item = &str>[src]
Returns all keywords (keyw).
pub fn keyword(&self) -> Option<&str>[src]
Returns the first keyword (keyw).
pub fn take_keywords(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all keywords (keyw).
pub fn take_keyword(&mut self) -> Option<String>[src]
Consumes all and returns the first keyword (keyw).
pub fn set_keyword(&mut self, keyword: impl Into<String>)[src]
Sets the keyword (keyw). This will remove all other keywords.
pub fn add_keyword(&mut self, keyword: impl Into<String>)[src]
Adds an keyword (keyw).
pub fn remove_keywords(&mut self)[src]
Removes all keywords (keyw).
impl Tag[src]
impl Tag[src]pub fn lyricists(&self) -> impl Iterator<Item = &str>[src]
Returns all lyricists (----:com.apple.iTunes:LYRICIST).
pub fn lyricist(&self) -> Option<&str>[src]
Returns the first lyricist (----:com.apple.iTunes:LYRICIST).
pub fn take_lyricists(&mut self) -> impl Iterator<Item = String> + '_[src]
Consumes and returns all lyricists (----:com.apple.iTunes:LYRICIST).
pub fn take_lyricist(&mut self) -> Option<String>[src]
Consumes all and returns the first lyricist (----:com.apple.iTunes:LYRICIST).
pub fn set_lyricist(&mut self, lyricist: impl Into<String>)[src]
Sets the lyricist (----:com.apple.iTunes:LYRICIST). This will remove all other lyricists.
pub fn add_lyricist(&mut self, lyricist: impl Into<String>)[src]
Adds an lyricist (----:com.apple.iTunes:LYRICIST).
pub fn remove_lyricists(&mut self)[src]
Removes all lyricists (----:com.apple.iTunes:LYRICIST).
impl Tag[src]
impl Tag[src]pub fn compilation(&self) -> bool[src]
Returns the compilation flag (cpil).
pub fn set_compilation(&mut self)[src]
Sets the compilation flag to true (cpil).
pub fn remove_compilation(&mut self)[src]
Removes the compilation flag (cpil).
impl Tag[src]
impl Tag[src]pub fn gapless_playback(&self) -> bool[src]
Returns the gapless playback flag (pgap).
pub fn set_gapless_playback(&mut self)[src]
Sets the gapless playback flag to true (pgap).
pub fn remove_gapless_playback(&mut self)[src]
Removes the gapless playback flag (pgap).
impl Tag[src]
impl Tag[src]pub fn show_movement(&self) -> bool[src]
Returns the show movement flag (shwm).
pub fn set_show_movement(&mut self)[src]
Sets the show movement flag to true (shwm).
pub fn remove_show_movement(&mut self)[src]
Removes the show movement flag (shwm).
impl Tag[src]
impl Tag[src]pub fn movement_count(&self) -> Option<u16>[src]
Returns the movement count (©mvc)
pub fn set_movement_count(&mut self, movement_count: u16)[src]
Sets the movement count (©mvc)
pub fn remove_movement_count(&mut self)[src]
Removes the movement count (©mvc).
impl Tag[src]
impl Tag[src]pub fn movement_index(&self) -> Option<u16>[src]
Returns the movement index (©mvi)
pub fn set_movement_index(&mut self, movement_index: u16)[src]
Sets the movement index (©mvi)
pub fn remove_movement_index(&mut self)[src]
Removes the movement index (©mvi).
impl Tag[src]
impl Tag[src]pub fn tv_episode(&self) -> Option<u32>[src]
Returns the tv episode (tves)
pub fn set_tv_episode(&mut self, tv_episode: u32)[src]
Sets the tv episode (tves)
pub fn remove_tv_episode(&mut self)[src]
Removes the tv episode (tves).
impl Tag[src]
impl Tag[src]pub fn tv_season(&self) -> Option<u32>[src]
Returns the tv season (tvsn)
pub fn set_tv_season(&mut self, tv_season: u32)[src]
Sets the tv season (tvsn)
pub fn remove_tv_season(&mut self)[src]
Removes the tv season (tvsn).
impl Tag[src]
impl Tag[src]pub fn artworks(&self) -> impl Iterator<Item = &Data>[src]
Returns all artwork images of type Data::Jpeg, Data::Png or Data::Bmp (covr).
pub fn artwork(&self) -> Option<&Data>[src]
Returns the first artwork image of type Data::Jpeg, Data::Png or Data::Bmp
(covr).
pub fn take_artworks(&mut self) -> impl Iterator<Item = Data> + '_[src]
Consumes and returns all artwork images of type Data::Jpeg, Data::Png or
Data::Bmp (covr).
pub fn take_artwork(&mut self) -> Option<Data>[src]
Consumes all and returns the first artwork image of type Data::Jpeg, Data::Png or
Data::Bmp (covr).
pub fn set_artwork(&mut self, image: Data)[src]
Sets the artwork image data of type Data::Jpeg, Data::Png or Data::Bmp (covr).
This will remove all other artworks.
pub fn add_artwork(&mut self, image: Data)[src]
Adds artwork image data of type Data::Jpeg, Data::Png or Data::Bmp (covr).
pub fn remove_artwork(&mut self)[src]
Removes all artworks (covr).
impl Tag[src]
impl Tag[src]pub fn media_type(&self) -> Option<MediaType>[src]
Returns the media type (stik).
pub fn set_media_type(&mut self, media_type: MediaType)[src]
Sets the media type (stik).
pub fn remove_media_type(&mut self)[src]
Removes the media type (stik).
impl Tag[src]
impl Tag[src]pub fn advisory_rating(&self) -> Option<AdvisoryRating>[src]
Returns the advisory rating (rtng).
pub fn set_advisory_rating(&mut self, rating: AdvisoryRating)[src]
Sets the advisory rating (rtng).
pub fn remove_advisory_rating(&mut self)[src]
Removes the advisory rating (rtng).
impl Tag[src]
impl Tag[src]pub fn bytes<'a>(
&'a self,
ident: &'a impl Ident
) -> impl Iterator<Item = &Vec<u8>>[src]
&'a self,
ident: &'a impl Ident
) -> impl Iterator<Item = &Vec<u8>>
Returns all byte data references corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::BeSigned(b"data".to_vec())); assert_eq!(tag.bytes(&test).next().unwrap(), b"data");
pub fn bytes_mut<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut Vec<u8>>[src]
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut Vec<u8>>
Returns all mutable string references corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Reserved(b"data".to_vec())); tag.bytes_mut(&test).next().unwrap().push(49); assert_eq!(tag.bytes(&test).next().unwrap(), b"data1");
pub fn take_bytes<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = Vec<u8>> + '_[src]
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = Vec<u8>> + '_
Consumes all byte data corresponding to the identifier and returns it.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Reserved(b"data".to_vec())); assert_eq!(tag.take_bytes(&test).next(), Some(b"data".to_vec())); assert_eq!(tag.bytes(&test).next(), None);
pub fn string<'a>(&'a self, ident: &'a impl Ident) -> impl Iterator<Item = &str>[src]
Returns all string references corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); assert_eq!(tag.string(&test).next().unwrap(), "data");
pub fn string_mut<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut String>[src]
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut String>
Returns all mutable string references corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); tag.string_mut(&test).next().unwrap().push('1'); assert_eq!(tag.string(&test).next().unwrap(), "data1");
pub fn take_string<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = String>[src]
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = String>
Consumes all strings corresponding to the identifier and returns them.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); assert_eq!(tag.take_string(&test).next(), Some("data".into())); assert_eq!(tag.string(&test).next(), None);
pub fn image<'a>(&'a self, ident: &'a impl Ident) -> impl Iterator<Item = &Data>[src]
Returns all image data references of type Data::Jpeg, Data::Png or Data::Bmp
corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Jpeg(b"<the image data>".to_vec())); match tag.image(&test).next().unwrap() { Data::Jpeg(v) => assert_eq!(*v, b"<the image data>"), _ => panic!("data does not match"), };
pub fn image_mut<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut Data>[src]
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut Data>
Returns all mutable image data references of type Data::Jpeg, Data::Png or
Data::Bmp corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Jpeg(b"<the image data>".to_vec())); match tag.image_mut(&test).next().unwrap() { Data::Jpeg(v) => v.push(49), _ => panic!("data type does match"), } match tag.image(&test).next().unwrap() { Data::Jpeg(v) => assert_eq!(*v, b"<the image data>1"), _ => panic!("data does not match"), };
pub fn take_image(&mut self, ident: &impl Ident) -> impl Iterator<Item = Data>[src]
Consumes all images corresponding to the identifier and returns them.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Png(b"<the image data>".to_vec())); match tag.take_data(&test).next().unwrap() { Data::Png(s) => assert_eq!(s, b"<the image data>".to_vec()), _ => panic!("data does not match"), }; assert_eq!(tag.string(&test).next(), None);
pub fn data<'a>(&'a self, ident: &'a impl Ident) -> impl Iterator<Item = &Data>[src]
Returns all data references corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); match tag.data(&test).next().unwrap() { Data::Utf8(s) => assert_eq!(s, "data"), _ => panic!("data does not match"), };
pub fn data_mut<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut Data>[src]
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut Data>
Returns all mutable data references corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); if let Data::Utf8(s) = tag.data_mut(&test).next().unwrap() { s.push('1'); } assert_eq!(tag.string(&test).next().unwrap(), "data1");
pub fn take_data(&mut self, ident: &impl Ident) -> impl Iterator<Item = Data>[src]
Consumes all data corresponding to the identifier and returns it.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); match tag.take_data(&test).next().unwrap() { Data::Utf8(s) => assert_eq!(s, "data".to_string()), _ => panic!("data does not match"), }; assert_eq!(tag.string(&test).next(), None);
pub fn set_data(&mut self, ident: impl Into<DataIdent>, data: Data)[src]
Removes all other atoms, corresponding to the identifier, and adds a new atom containing the provided data.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); assert_eq!(tag.string(&test).next().unwrap(), "data");
pub fn add_data(&mut self, ident: impl Into<DataIdent>, data: Data)[src]
Adds a new atom, corresponding to the identifier, containing the provided data.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.add_data(test, Data::Utf8("data1".into())); tag.add_data(test, Data::Utf8("data2".into())); let mut strings = tag.string(&test); assert_eq!(strings.next(), Some("data1")); assert_eq!(strings.next(), Some("data2")); assert_eq!(strings.next(), None)
pub fn remove_data(&mut self, ident: &impl Ident)[src]
Removes the data corresponding to the identifier.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.set_data(test, Data::Utf8("data".into())); assert!(tag.data(&test).next().is_some()); tag.remove_data(&test); assert!(tag.data(&test).next().is_none());
Trait Implementations
impl StructuralEq for Tag[src]
impl StructuralEq for Tag[src]impl StructuralPartialEq for Tag[src]
impl StructuralPartialEq for Tag[src]Auto Trait Implementations
impl RefUnwindSafe for Tag
impl RefUnwindSafe for Tagimpl UnwindSafe for Tag
impl UnwindSafe for Tag