Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Properties**: Expose channel mask (only supported for WAV and MPEG for now) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/155))
- **ItemKey**: `InitialKey` mapping for Vorbis Comments ([PR](https://github.com/Serial-ATA/lofty-rs/pull/156))
- **VorbisComments**: `VorbisComments::push` to allow for a non-replacing insertion
- **Tags**: `<Tag>::new()` as an alias for `<Tag>::default()`

### Changed
- **APE**/**ID3v1**/**ID3v2**/**Tag**:
Expand Down
15 changes: 15 additions & 0 deletions src/ape/tag/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ pub struct ApeTag {
}

impl ApeTag {
/// Create a new empty `ApeTag`
///
/// # Examples
///
/// ```rust
/// use lofty::ape::ApeTag;
/// use lofty::TagExt;
///
/// let ape_tag = ApeTag::new();
/// assert!(ape_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}

/// Get an [`ApeItem`] by key
///
/// NOTE: While `APE` items are supposed to be case-sensitive,
Expand Down
17 changes: 17 additions & 0 deletions src/id3/v1/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ pub struct ID3v1Tag {
pub genre: Option<u8>,
}

impl ID3v1Tag {
/// Create a new empty `ID3v1Tag`
///
/// # Examples
///
/// ```rust
/// use lofty::id3::v1::ID3v1Tag;
/// use lofty::TagExt;
///
/// let id3v1_tag = ID3v1Tag::new();
/// assert!(id3v1_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}
}

impl Accessor for ID3v1Tag {
impl_accessor!(title, artist, album,);

Expand Down
15 changes: 15 additions & 0 deletions src/id3/v2/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,21 @@ impl Default for ID3v2Tag {
}

impl ID3v2Tag {
/// Create a new empty `ID3v2Tag`
///
/// # Examples
///
/// ```rust
/// use lofty::id3::v2::ID3v2Tag;
/// use lofty::TagExt;
///
/// let id3v2_tag = ID3v2Tag::new();
/// assert!(id3v2_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}

/// Returns the [`ID3v2TagFlags`]
pub fn flags(&self) -> &ID3v2TagFlags {
&self.flags
Expand Down
15 changes: 15 additions & 0 deletions src/iff/aiff/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ impl Accessor for AIFFTextChunks {
}

impl AIFFTextChunks {
/// Create a new empty `AIFFTextChunks`
///
/// # Examples
///
/// ```rust
/// use lofty::iff::aiff::AIFFTextChunks;
/// use lofty::TagExt;
///
/// let aiff_tag = AIFFTextChunks::new();
/// assert!(aiff_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}

/// Returns the copyright message
pub fn copyright(&self) -> Option<&str> {
self.copyright.as_deref()
Expand Down
15 changes: 15 additions & 0 deletions src/iff/wav/tag/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ pub struct RIFFInfoList {
}

impl RIFFInfoList {
/// Create a new empty `RIFFInfoList`
///
/// # Examples
///
/// ```rust
/// use lofty::iff::wav::RIFFInfoList;
/// use lofty::TagExt;
///
/// let riff_info_tag = RIFFInfoList::new();
/// assert!(riff_info_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}

/// Get an item by key
pub fn get(&self, key: &str) -> Option<&str> {
self.items
Expand Down
15 changes: 15 additions & 0 deletions src/mp4/ilst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ pub struct Ilst {
}

impl Ilst {
/// Create a new empty `Ilst`
///
/// # Examples
///
/// ```rust
/// use lofty::mp4::Ilst;
/// use lofty::TagExt;
///
/// let ilst_tag = Ilst::new();
/// assert!(ilst_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}

/// Get an item by its [`AtomIdent`]
pub fn atom(&self, ident: &AtomIdent<'_>) -> Option<&Atom<'static>> {
self.atoms.iter().find(|a| &a.ident == ident)
Expand Down
15 changes: 15 additions & 0 deletions src/ogg/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ pub struct VorbisComments {
}

impl VorbisComments {
/// Create a new empty `VorbisComments`
///
/// # Examples
///
/// ```rust
/// use lofty::ogg::VorbisComments;
/// use lofty::TagExt;
///
/// let vorbis_comments_tag = VorbisComments::new();
/// assert!(vorbis_comments_tag.is_empty());
/// ```
pub fn new() -> Self {
Self::default()
}

/// Returns the vendor string
pub fn vendor(&self) -> &str {
&self.vendor
Expand Down