From 5c4562afc2b8a337d1b1df8aaa9d80f848cb968b Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Mon, 6 Oct 2025 14:50:15 +0200 Subject: [PATCH] doc: add doc comments for delete and improve doc comment for persist --- 01.workspace/heave/src/str/catalog.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/01.workspace/heave/src/str/catalog.rs b/01.workspace/heave/src/str/catalog.rs index fb7d215..dc7130c 100644 --- a/01.workspace/heave/src/str/catalog.rs +++ b/01.workspace/heave/src/str/catalog.rs @@ -138,6 +138,11 @@ impl O { .map(|item| T::from(item.clone())) } + /// Schedules an entity for deletion. Actual delition will take place when 'persist' is called. + /// + /// # Arguments + /// + /// * `id` - The ID of the entity to delete. pub fn delete(&mut self, id: &str) { let entity = self.items.get_mut(id); if let Some(entity) = entity { @@ -146,6 +151,9 @@ impl O { } /// Persists the current state of the catalog to the database. + /// + /// - new entities will be written onto DB + /// - marked for delition entities will be deleted pub fn persist(&self) -> result::Result<(), FailedTo> { let path = path::Path::new(&self.path); sqlite::persist::catalog(path, self).map_err(|_| FailedTo::PersistCatalog)?;