diff --git a/Cargo.toml b/Cargo.toml index b5d115e..d900a53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,5 +12,7 @@ log = "0.4" tokio = { version = "1.2", features = ["macros", "rt"]} reqwest = "0.11" minidom = "0.13" -url = "2.2" +url = { version = "2.2", features = ["serde"] } bitflags = "1.2" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" diff --git a/src/calendar.rs b/src/calendar.rs index 251cbe7..4ac829b 100644 --- a/src/calendar.rs +++ b/src/calendar.rs @@ -2,6 +2,7 @@ use std::convert::TryFrom; use std::error::Error; use url::Url; +use serde::{Deserialize, Serialize}; use crate::task::Task; use crate::task::TaskId; @@ -9,6 +10,7 @@ use crate::task::TaskId; use bitflags::bitflags; bitflags! { + #[derive(Serialize, Deserialize)] pub struct SupportedComponents: u8 { /// An event, such as a calendar meeting const EVENT = 1; @@ -45,7 +47,7 @@ impl TryFrom for SupportedComponents { /// A Caldav Calendar -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Calendar { name: String, url: Url, diff --git a/src/task.rs b/src/task.rs index fa50166..d590ea8 100644 --- a/src/task.rs +++ b/src/task.rs @@ -1,7 +1,9 @@ +use serde::{Deserialize, Serialize}; + pub type TaskId = String; // This is an HTML "etag" /// A to-do task -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Task { id: TaskId, name: String,