2024-03-09 19:11:59 +01:00
|
|
|
use musichoard::{
|
|
|
|
collection::Collection, interface::database::IDatabase, interface::library::ILibrary,
|
2024-03-09 22:52:03 +01:00
|
|
|
IMusicHoardBase, IMusicHoardDatabase, IMusicHoardLibrary, MusicHoard,
|
2024-03-09 19:11:59 +01:00
|
|
|
};
|
2023-05-10 22:52:03 +02:00
|
|
|
|
|
|
|
#[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>;
|
2024-03-01 09:00:52 +01:00
|
|
|
fn reload_database(&mut self) -> Result<(), musichoard::Error>;
|
2023-05-10 22:52:03 +02:00
|
|
|
fn get_collection(&self) -> &Collection;
|
|
|
|
}
|
|
|
|
|
|
|
|
// GRCOV_EXCL_START
|
2024-03-09 22:52:03 +01:00
|
|
|
impl<Database: IDatabase, Library: ILibrary> IMusicHoard for MusicHoard<Database, Library> {
|
2023-05-20 00:02:39 +02:00
|
|
|
fn rescan_library(&mut self) -> Result<(), musichoard::Error> {
|
2024-03-09 22:52:03 +01:00
|
|
|
<Self as IMusicHoardLibrary>::rescan_library(self)
|
2023-05-20 00:02:39 +02:00
|
|
|
}
|
|
|
|
|
2024-03-01 09:00:52 +01:00
|
|
|
fn reload_database(&mut self) -> Result<(), musichoard::Error> {
|
2024-03-09 22:52:03 +01:00
|
|
|
<Self as IMusicHoardDatabase>::reload_database(self)
|
2023-05-10 22:52:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn get_collection(&self) -> &Collection {
|
2024-03-09 22:52:03 +01:00
|
|
|
<Self as IMusicHoardBase>::get_collection(self)
|
2023-05-10 22:52:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// GRCOV_EXCL_STOP
|