Added functions to the trait
This commit is contained in:
parent
8ecab2c182
commit
6b1d5635c6
2 changed files with 30 additions and 1 deletions
18
src/cache.rs
18
src/cache.rs
|
@ -6,6 +6,7 @@ use std::error::Error;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use async_trait::async_trait;
|
||||
use url::Url;
|
||||
|
||||
use crate::traits::CalDavSource;
|
||||
use crate::Calendar;
|
||||
|
@ -88,6 +89,23 @@ impl CalDavSource for Cache {
|
|||
.collect()
|
||||
)
|
||||
}
|
||||
|
||||
async fn get_calendar(&self, url: Url) -> Option<&Calendar> {
|
||||
for cal in &self.data.calendars {
|
||||
if cal.url() == &url {
|
||||
return Some(cal);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
async fn get_calendar_mut(&mut self, url: Url) -> Option<&mut Calendar> {
|
||||
for cal in &mut self.data.calendars {
|
||||
if cal.url() == &url {
|
||||
return Some(cal);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue