Browse Source

Implemented get_item_by_id for CachedCalendar

github_actions
daladim 5 years ago
parent
commit
707d764e6b
  1. 4
      src/calendar/cached_calendar.rs
  2. 6
      src/traits.rs

4
src/calendar/cached_calendar.rs

@ -137,6 +137,10 @@ impl DavCalendar for CachedCalendar {
Ok(result)
}
async fn get_item_by_id(&self, id: &ItemId) -> Result<Option<Item>, Box<dyn Error>> {
Ok(self.items.get(id).cloned())
}
async fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box<dyn Error>> {
self.immediately_delete_item(item_id).await
}

6
src/traits.rs

@ -54,6 +54,9 @@ pub trait DavCalendar : BaseCalendar {
/// Get the IDs and the version tags of every item in this calendar
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>>;
/// Returns a particular item
async fn get_item_by_id(&self, id: &ItemId) -> Result<Option<Item>, Box<dyn Error>>;
/// Delete an item
async fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box<dyn Error>>;
@ -64,9 +67,6 @@ pub trait DavCalendar : BaseCalendar {
.map(|(id, _tag)| id.clone())
.collect())
}
/// Returns a particular item
async fn get_item_by_id(&self, id: &ItemId) -> Result<Option<Item>, Box<dyn Error>>;
}

Loading…
Cancel
Save