Rename features

This commit is contained in:
Serial 2021-08-18 21:58:27 -04:00
parent 06bf9b0862
commit 60846d23dc
3 changed files with 49 additions and 53 deletions

View file

@ -28,17 +28,14 @@ byteorder = "1.4.3"
cfg-if = "1.0.0" cfg-if = "1.0.0"
[features] [features]
default = ["all_tags"] default = ["mp4_atoms", "vorbis_comments", "ape", "id3v1", "id3v2", "aiff_text_chunks", "riff_info_list"]
format-mp4 = ["mp4ameta"] mp4_atoms = []
format-flac = ["unicase"] vorbis_comments = ["ogg_pager"]
format-opus = ["ogg_pager", "unicase"] ape = []
format-vorbis = ["ogg_pager", "unicase"] id3v1 = []
format-ape = ["unicase"] id3v2 = []
format-id3 = ["id3", "filepath"] aiff_text_chunks = []
format-aiff = [] riff_info_list = []
format-riff = []
format-ogg = ["format-flac", "format-opus", "format-vorbis"]
all_tags = ["format-ogg", "format-mp4", "format-id3", "format-riff", "format-ape", "format-aiff"]
[dev-dependencies] [dev-dependencies]
criterion = { version = "0.3", features = ["html_reports"] } criterion = { version = "0.3", features = ["html_reports"] }

View file

@ -29,20 +29,16 @@ pub enum LoftyError {
NotAPicture, NotAPicture,
// Tag related errors // Tag related errors
#[cfg(feature = "format-id3")] #[cfg(feature = "id3")] // TODO
/// Any error from [`id3`] /// Any error from [`id3`]
#[error(transparent)] #[error(transparent)]
Id3Tag(#[from] id3::Error), Id3Tag(#[from] id3::Error),
#[cfg(feature = "format-mp4")] #[cfg(feature = "mp4ameta")] // TODO
/// Any error from [`mp4ameta`] /// Any error from [`mp4ameta`]
#[error(transparent)] #[error(transparent)]
Mp4Tag(#[from] mp4ameta::Error), Mp4Tag(#[from] mp4ameta::Error),
/// Errors that arrist while parsing OGG pages /// Errors that arise while parsing OGG pages
#[cfg(any( #[cfg(feature = "vorbis_comments")]
feature = "format-opus",
feature = "format-vorbis",
feature = "format-flac"
))]
#[error(transparent)] #[error(transparent)]
OggPage(#[from] ogg_pager::PageError), OggPage(#[from] ogg_pager::PageError),
/// Errors that arise while reading/writing to WAV files /// Errors that arise while reading/writing to WAV files

View file

@ -10,7 +10,7 @@
//! //!
//! | File Format | Extensions | Read | Write | Metadata Format(s) | //! | File Format | Extensions | Read | Write | Metadata Format(s) |
//! |-------------|-------------------------------------------|------|-------|----------------------------------------------------| //! |-------------|-------------------------------------------|------|-------|----------------------------------------------------|
//! | Ape | `ape` |**X** |**X** |`APEv2`, `APEv1`, `ID3v2` (Not officially), `ID3v1` | //! | APE | `ape` |**X** |**X** |`APEv2`, `APEv1`, `ID3v2` (Not officially), `ID3v1` |
//! | AIFF | `aiff`, `aif` |**X** |**X** |`ID3v2`, `Text Chunks` | //! | AIFF | `aiff`, `aif` |**X** |**X** |`ID3v2`, `Text Chunks` |
//! | FLAC | `flac` |**X** |**X** |`Vorbis Comments` | //! | FLAC | `flac` |**X** |**X** |`Vorbis Comments` |
//! | MP3 | `mp3` |**X** |**X** |`ID3v2`, `ID3v1`, `APEv2`, `APEv1` | //! | MP3 | `mp3` |**X** |**X** |`ID3v2`, `ID3v1`, `APEv2`, `APEv1` |
@ -78,35 +78,21 @@
//! assert_eq!(oggtag.artist(), Some("Foo artist")); //! assert_eq!(oggtag.artist(), Some("Foo artist"));
//! ``` //! ```
//! //!
//! # Concrete types
//! * AiffTag (AIFF Text Chunks)
//! * ApeTag
//! * Id3v2Tag
//! * Mp4Tag
//! * OggTag
//! * RiffTag (RIFF LIST INFO)
//!
//! # Features //! # Features
//! //!
//! ## Applies to all //! ## Applies to all
//! * `all_tags` - Enables all formats //! * `all_tags` - Enables all formats
//! //!
//! ## Individual formats //! ## Individual formats
//! These features are available if you have a specific usecase, or just don't want certain formats. //! These features are available if you have a specific use case, or just don't want certain formats.
//! //!
//! All format features a prefixed with `format-` //! * `aiff_text_chunks`
//! * `format-ape` //! * `ape`
//! * `format-flac` //! * `id3v1`
//! * `format-id3` //! * `id3v2`
//! * `format-mp4` //! * `mp4_atoms`
//! * `format-opus` //! * `riff_info_list`
//! * `format-vorbis` //! * `vorbis_comments`
//! * `format-riff`
//!
//! ## Umbrella features
//! These cover all formats under a container format.
//!
//! * `format-ogg` (`format-opus`, `format-vorbis`, `format-flac`)
#![deny(clippy::pedantic, clippy::all, missing_docs)] #![deny(clippy::pedantic, clippy::all, missing_docs)]
#![allow( #![allow(
@ -124,25 +110,42 @@
clippy::used_underscore_binding clippy::used_underscore_binding
)] )]
mod types; pub use crate::error::{LoftyError, Result};
pub use crate::probe::Probe;
pub use crate::types::{ pub use crate::types::{
album::Album, album::Album,
anytag::AnyTag, anytag::AnyTag,
file::{FileType, TaggedFile}, file::{FileType, TaggedFile},
item::ItemKey, item::ItemKey,
picture::{MimeType, Picture, PictureType},
properties::FileProperties, properties::FileProperties,
tag::{ItemValue, Tag, TagItem, TagType}, tag::{ItemValue, Tag, TagItem, TagType},
}; };
mod probe; mod types;
pub use crate::probe::Probe;
/// Various concrete file types, used when inference is unnecessary
pub mod files {
pub use crate::logic::ape::ApeFile;
pub use crate::logic::iff::{aiff::AiffFile, wav::WavFile};
pub use crate::logic::mpeg::MpegFile;
pub use crate::logic::ogg::{flac::FlacFile, opus::OpusFile, vorbis::VorbisFile};
}
#[cfg(any(feature = "id3v1", feature = "id3v2"))]
/// ID3v1/v2 specific items
pub mod id3 {
pub use crate::logic::id3::v2::Id3v2Version;
}
/// Various items related to [`Picture`](crate::picture::Picture)s
pub mod picture {
pub use crate::types::picture::{
MimeType, Picture, PictureInformation, PictureType, TextEncoding,
};
}
mod error; mod error;
pub use crate::error::{LoftyError, Result}; pub(crate) mod logic;
mod probe;
mod components;
pub use crate::components::tags::*;
mod traits;
pub use crate::traits::{AudioTag, AudioTagEdit, AudioTagWrite, ToAny, ToAnyTag};