chore: run cargo format and delete empty lines in catalog.rs

This commit is contained in:
2025-10-19 10:27:41 +02:00
parent 45093a5672
commit 01a6e2ce48

View File

@@ -26,14 +26,12 @@ impl Catalog {
..O::default()
}
}
/// Initializes the database.
pub fn init(&self) -> result::Result<(), FailedTo> {
let path = path::Path::new(&self.path);
sqlite::init::db(path).map_err(|_| FailedTo::InitDatabase)?;
Ok(())
}
/// Inserts or updates a single object that implements the `EAV` trait into the catalog.
///
/// # Arguments
@@ -49,7 +47,6 @@ impl Catalog {
self.items.insert(entity.id.clone(), entity);
Ok(())
}
/// Inserts multiple objects that implement the `EAV` trait into the catalog.
///
/// # Arguments
@@ -61,7 +58,6 @@ impl Catalog {
}
Ok(())
}
/// Retrieves an entity by its ID and converts it into a specified type `T`.
///
/// # Arguments
@@ -80,7 +76,6 @@ impl Catalog {
.map(|e| T::try_from(e.clone()).map_err(|_| FailedTo::ConvertEntity))
.transpose()
}
/// Retrieves the first entity that matches a given attribute and value.
///
/// # Arguments
@@ -108,7 +103,6 @@ impl Catalog {
.map(|item| T::try_from(item.clone()).map_err(|_| FailedTo::ConvertEntity));
items.next().transpose()
}
/// Returns an iterator over entities of a specific class.
///
/// # Returns
@@ -123,7 +117,6 @@ impl Catalog {
.filter(move |item| item.class == T::class())
.map(|item| T::try_from(item.clone()).map_err(|_| FailedTo::ConvertEntity))
}
/// Returns an iterator over entities that match a given attribute and value.
///
/// # Arguments
@@ -149,7 +142,6 @@ impl Catalog {
.filter(move |item| item.value_of(attribute) == Some(&value))
.map(|item| T::try_from(item.clone()).map_err(|_| FailedTo::ConvertEntity))
}
/// Schedules an entity for deletion. Actual delition will take place when 'persist' is called.
///
/// # Arguments
@@ -161,7 +153,6 @@ impl Catalog {
entity.state = EntityState::ToDelete;
}
}
/// Persists the current state of the catalog to the database.
///
/// - new entities will be written onto DB
@@ -185,7 +176,6 @@ impl Catalog {
.collect();
Ok(())
}
/// Loads an entity by its ID from the database into the catalog.
///
/// # Arguments
@@ -199,7 +189,6 @@ impl Catalog {
}
Ok(())
}
/// Loads all entities of a specific class from the database into the catalog.
pub fn load_by_class<T>(&mut self) -> Result<(), FailedTo>
where
@@ -213,7 +202,6 @@ impl Catalog {
}
Ok(())
}
/// Loads all entities matching the filter values
/// Different entity class with clashing attribute names might be loaded
pub fn load_by_filter(&mut self, filter: &Filter) -> Result<(), FailedTo> {