2023-05-10 22:52:03 +02:00
|
|
|
use musichoard::{database::IDatabase, library::ILibrary, Collection, MusicHoard};
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
use mockall::automock;
|
|
|
|
|
|
|
|
#[cfg_attr(test, automock)]
|
|
|
|
pub trait IMusicHoard {
|
2023-05-20 00:02:39 +02:00
|
|
|
fn rescan_library(&mut self) -> Result<(), musichoard::Error>;
|
|
|
|
fn load_from_database(&mut self) -> Result<(), musichoard::Error>;
|
|
|
|
fn save_to_database(&mut self) -> Result<(), musichoard::Error>;
|
2023-05-10 22:52:03 +02:00
|
|
|
fn get_collection(&self) -> &Collection;
|
|
|
|
}
|
|
|
|
|
|
|
|
// GRCOV_EXCL_START
|
|
|
|
impl<LIB: ILibrary, DB: IDatabase> IMusicHoard for MusicHoard<LIB, DB> {
|
2023-05-20 00:02:39 +02:00
|
|
|
fn rescan_library(&mut self) -> Result<(), musichoard::Error> {
|
|
|
|
MusicHoard::rescan_library(self)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn load_from_database(&mut self) -> Result<(), musichoard::Error> {
|
|
|
|
MusicHoard::load_from_database(self)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn save_to_database(&mut self) -> Result<(), musichoard::Error> {
|
|
|
|
MusicHoard::save_to_database(self)
|
2023-05-10 22:52:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn get_collection(&self) -> &Collection {
|
|
|
|
MusicHoard::get_collection(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// GRCOV_EXCL_STOP
|