musichoard/src/tui/lib.rs

33 lines
994 B
Rust

use musichoard::{database::IDatabase, library::ILibrary, Collection, MusicHoard};
#[cfg(test)]
use mockall::automock;
#[cfg_attr(test, automock)]
pub trait IMusicHoard {
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>;
fn get_collection(&self) -> &Collection;
}
// GRCOV_EXCL_START
impl<LIB: ILibrary, DB: IDatabase> IMusicHoard for MusicHoard<LIB, DB> {
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)
}
fn get_collection(&self) -> &Collection {
MusicHoard::get_collection(self)
}
}
// GRCOV_EXCL_STOP