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
|
/// The collection manager. It is responsible for pulling information from both the library and the
|
||||||
/// database, ensuring its consistent and writing back any changes.
|
/// database, ensuring its consistent and writing back any changes.
|
||||||
pub struct MhCollectionManager<L, D> {
|
pub struct MhCollectionManager<LIB, DB> {
|
||||||
library: L,
|
library: LIB,
|
||||||
database: D,
|
database: DB,
|
||||||
collection: Collection,
|
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`].
|
/// 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 {
|
MhCollectionManager {
|
||||||
library,
|
library,
|
||||||
database,
|
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> {
|
fn rescan_library(&mut self) -> Result<(), Error> {
|
||||||
self.collection = self.library.list(&Query::default())?;
|
self.collection = self.library.list(&Query::default())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user