use super::tagged_file::TaggedFile;
use crate::config::{ParseOptions, WriteOptions};
use crate::error::{LoftyError, Result};
use crate::tag::TagType;
use crate::util::io::{FileLike, Length, Truncate};
use std::fs::OpenOptions;
use std::io::{Read, Seek};
use std::path::Path;
pub trait AudioFile: Into<TaggedFile> {
type Properties;
fn read_from<R>(reader: &mut R, parse_options: ParseOptions) -> Result<Self>
where
R: Read + Seek,
Self: Sized;
fn save_to_path(&self, path: impl AsRef<Path>, write_options: WriteOptions) -> Result<()> {
self.save_to(
&mut OpenOptions::new().read(true).write(true).open(path)?,
write_options,
)
}
fn save_to<F>(&self, file: &mut F, write_options: WriteOptions) -> Result<()>
where
F: FileLike,
LoftyError: From<<F as Truncate>::Error>,
LoftyError: From<<F as Length>::Error>;
fn properties(&self) -> &Self::Properties;
fn contains_tag(&self) -> bool;
fn contains_tag_type(&self, tag_type: TagType) -> bool;
}