This commit is contained in:
Wojciech Kozlowski 2024-03-09 20:49:24 +01:00
parent 90225d9b85
commit ed271cf2a2

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> {