Made stuff serializable

This commit is contained in:
daladim 2021-02-24 17:38:08 +01:00
parent 03884c6ff9
commit 1451f41ae3
3 changed files with 9 additions and 3 deletions

View file

@ -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"

View file

@ -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<minidom::Element> for SupportedComponents {
/// A Caldav Calendar
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Calendar {
name: String,
url: Url,

View file

@ -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,