use std::path::Path;
use crate::SUPPORTED_CONTAINERS;
use serde::{Deserialize, Serialize};
mod container_type_matcher;
pub use container_type_matcher::*;
mod trait_impls;
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Ord, Eq, Serialize, Deserialize)]
pub enum ContainerFormat {
Flac,
Mp3,
Ogg,
Wav,
}
impl ContainerFormat {
#[must_use]
pub fn format_name(&self) -> &str {
match self {
ContainerFormat::Flac => "flac",
ContainerFormat::Mp3 => "mp3",
ContainerFormat::Ogg => "ogg",
ContainerFormat::Wav => "wav",
}
}
#[must_use]
pub fn is_supported(&self) -> bool {
SUPPORTED_CONTAINERS.contains(self)
}
pub fn from_file(path: impl AsRef<Path>) -> Option<Self> {
container_from_file(path)
}
}