Replace as many Box<dyn Trait> with generics as possible #32
@ -56,15 +56,15 @@ pub trait CollectionManager {
|
||||
|
||||
/// The collection manager. It is responsible for pulling information from both the library and the
|
||||
/// database, ensuring its consistent and writing back any changes.
|
||||
pub struct MhCollectionManager<L, D> {
|
||||
library: L,
|
||||
database: D,
|
||||
pub struct MhCollectionManager<LIB, DB> {
|
||||
library: LIB,
|
||||
database: DB,
|
||||
collection: Collection,
|
||||
}
|
||||
|
||||
impl<L: Library, D: Database> MhCollectionManager<L, D> {
|
||||
impl<LIB: Library, DB: Database> MhCollectionManager<LIB, DB> {
|
||||
/// Create a new [`CollectionManager`] with the provided [`Library`] and [`Database`].
|
||||
pub fn new(library: L, database: D) -> Self {
|
||||
pub fn new(library: LIB, database: DB) -> Self {
|
||||
MhCollectionManager {
|
||||
library,
|
||||
database,
|
||||
@ -73,7 +73,7 @@ impl<L: Library, D: Database> MhCollectionManager<L, D> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<L: Library, D: Database> CollectionManager for MhCollectionManager<L, D> {
|
||||
impl<LIB: Library, DB: Database> CollectionManager for MhCollectionManager<LIB, DB> {
|
||||
fn rescan_library(&mut self) -> Result<(), Error> {
|
||||
self.collection = self.library.list(&Query::default())?;
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user