kitchen-freezer/src/traits.rs

17 lines
672 B
Rust
Raw Normal View History

2021-02-20 00:10:05 +01:00
use std::error::Error;
2021-02-18 12:02:04 +01:00
2021-02-25 00:47:39 +01:00
use async_trait::async_trait;
2021-02-18 12:02:04 +01:00
2021-02-25 00:47:39 +01:00
use crate::Calendar;
2021-02-18 12:02:04 +01:00
2021-02-25 00:47:39 +01:00
#[async_trait]
pub trait CalDavSource {
/// Returns the current calendars that this source contains
/// This function may trigger an update (that can be a long process, or that can even fail, e.g. in case of a remote server)
async fn get_calendars(&self) -> Result<&Vec<Calendar>, Box<dyn Error>>;
2021-02-18 12:02:04 +01:00
2021-02-25 00:47:39 +01:00
/// Returns the current calendars that this source contains
/// This function may trigger an update (that can be a long process, or that can even fail, e.g. in case of a remote server)
async fn get_calendars_mut(&mut self) -> Result<Vec<&mut Calendar>, Box<dyn Error>>;
2021-02-18 12:02:04 +01:00
}