chore: rename load_by_class_and_subclass to load_by_subclass

This commit is contained in:
2025-11-13 10:11:24 +01:00
parent cb0f0cfa31
commit 4428cd094f
3 changed files with 5 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
use crate::*; use crate::*;
impl Catalog { impl Catalog {
/// Returns a list of all entities of a specific class and subclass from the in-memory catalog. /// Returns a list of all entities of a specific subclass from the in-memory catalog.
/// ///
/// This method filters the in-memory entities by the class of type `T` and the /// This method filters the in-memory entities by the class of type `T` and the
/// provided `subclass`, then attempts to convert them into `T`. This is a purely /// provided `subclass`, then attempts to convert them into `T`. This is a purely
@@ -24,10 +24,7 @@ impl Catalog {
/// ///
/// Returns `Err(FailedTo::LockCatalog)` if the catalog's internal mutex /// Returns `Err(FailedTo::LockCatalog)` if the catalog's internal mutex
/// could not be locked. /// could not be locked.
pub fn list_by_class_and_subclass<T>( pub fn list_by_subclass<T>(&self, subclass: &str) -> Result<Vec<Result<T, FailedTo>>, FailedTo>
&self,
subclass: &str,
) -> Result<Vec<Result<T, FailedTo>>, FailedTo>
where where
T: EAV, T: EAV,
{ {

View File

@@ -10,7 +10,7 @@ pub mod catalog_insert_many;
pub mod catalog_is_empty; pub mod catalog_is_empty;
pub mod catalog_len; pub mod catalog_len;
pub mod catalog_list_by_class; pub mod catalog_list_by_class;
pub mod catalog_list_by_class_and_subclass; pub mod catalog_list_by_subclass;
pub mod catalog_load; pub mod catalog_load;
pub mod catalog_load_by_filter; pub mod catalog_load_by_filter;
pub mod catalog_load_by_id; pub mod catalog_load_by_id;

View File

@@ -23,7 +23,7 @@ mod tests {
let _ = catalog.upsert(item2.clone()); let _ = catalog.upsert(item2.clone());
let _ = catalog.upsert(item3.clone()); let _ = catalog.upsert(item3.clone());
let results: Vec<_> = catalog let results: Vec<_> = catalog
.list_by_class_and_subclass::<Item>("electronics") .list_by_subclass::<Item>("electronics")
.unwrap() .unwrap()
.into_iter() .into_iter()
.map(|item| item.unwrap()) .map(|item| item.unwrap())
@@ -43,7 +43,7 @@ mod tests {
}; };
let _ = catalog.upsert(item1.clone()); let _ = catalog.upsert(item1.clone());
let results: Vec<_> = catalog let results: Vec<_> = catalog
.list_by_class_and_subclass::<Item>("books") .list_by_subclass::<Item>("books")
.unwrap() .unwrap()
.into_iter() .into_iter()
.map(|item| item.unwrap()) .map(|item| item.unwrap())