diff --git a/src/provider.rs b/src/provider/mod.rs similarity index 95% rename from src/provider.rs rename to src/provider/mod.rs index aad647e..e9cec70 100644 --- a/src/provider.rs +++ b/src/provider/mod.rs @@ -10,36 +10,8 @@ use crate::traits::CompleteCalendar; use crate::item::SyncStatus; use crate::calendar::CalendarId; -/// A counter of errors that happen during a sync -struct SyncResult { - n_errors: u32, -} -impl SyncResult { - pub fn new() -> Self { - Self { n_errors: 0 } - } - pub fn is_success(&self) -> bool { - self.n_errors == 0 - } - - pub fn error(&mut self, text: &str) { - log::error!("{}", text); - self.n_errors += 1; - } - pub fn warn(&mut self, text: &str) { - log::warn!("{}", text); - self.n_errors += 1; - } - pub fn info(&mut self, text: &str) { - log::info!("{}", text); - } - pub fn debug(&mut self, text: &str) { - log::debug!("{}", text); - } - pub fn trace(&mut self, text: &str) { - log::trace!("{}", text); - } -} +mod sync_progress; +use sync_progress::SyncResult; /// A data source that combines two `CalDavSource`s, which is able to sync both sources. /// diff --git a/src/provider/sync_progress.rs b/src/provider/sync_progress.rs new file mode 100644 index 0000000..1399233 --- /dev/null +++ b/src/provider/sync_progress.rs @@ -0,0 +1,30 @@ +/// A counter of errors that happen during a sync +pub struct SyncResult { + n_errors: u32, +} +impl SyncResult { + pub fn new() -> Self { + Self { n_errors: 0 } + } + pub fn is_success(&self) -> bool { + self.n_errors == 0 + } + + pub fn error(&mut self, text: &str) { + log::error!("{}", text); + self.n_errors += 1; + } + pub fn warn(&mut self, text: &str) { + log::warn!("{}", text); + self.n_errors += 1; + } + pub fn info(&mut self, text: &str) { + log::info!("{}", text); + } + pub fn debug(&mut self, text: &str) { + log::debug!("{}", text); + } + pub fn trace(&mut self, text: &str) { + log::trace!("{}", text); + } +}