Break down the musichoard files #165

Merged
wojtek merged 9 commits from 164---break-down-the-musichoard-files into main 2024-03-09 22:52:04 +01:00
Showing only changes of commit ed271cf2a2 - Show all commits

View File

@ -207,8 +207,7 @@ impl<LIB: ILibrary> MusicHoard<LIB, NoDatabase> {
/// Rescan the library and merge with the in-memory collection. /// Rescan the library and merge with the in-memory collection.
pub fn rescan_library(&mut self) -> Result<(), Error> { pub fn rescan_library(&mut self) -> Result<(), Error> {
self.pre_commit = self.rescan_library_inner()?; self.pre_commit = self.rescan_library_inner()?;
self.collection = self.pre_commit.clone(); self.commit()
Ok(())
} }
} }
@ -238,6 +237,13 @@ impl<DB: IDatabase> MusicHoard<NoLibrary, DB> {
} }
} }
impl<LIB> MusicHoard<LIB, NoDatabase> {
fn commit(&mut self) -> Result<(), Error> {
self.collection = self.pre_commit.clone();
Ok(())
}
}
impl<LIB, DB: IDatabase> MusicHoard<LIB, DB> { impl<LIB, DB: IDatabase> MusicHoard<LIB, DB> {
/// Load the database and merge with the in-memory collection. /// Load the database and merge with the in-memory collection.
pub fn reload_database(&mut self) -> Result<(), Error> { pub fn reload_database(&mut self) -> Result<(), Error> {