Browse Source

Made stuff serializable

github_actions
daladim 5 years ago
parent
commit
1451f41ae3
  1. 4
      Cargo.toml
  2. 4
      src/calendar.rs
  3. 4
      src/task.rs

4
Cargo.toml

@ -12,5 +12,7 @@ log = "0.4"
tokio = { version = "1.2", features = ["macros", "rt"]} tokio = { version = "1.2", features = ["macros", "rt"]}
reqwest = "0.11" reqwest = "0.11"
minidom = "0.13" minidom = "0.13"
url = "2.2" url = { version = "2.2", features = ["serde"] }
bitflags = "1.2" bitflags = "1.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

4
src/calendar.rs

@ -2,6 +2,7 @@ use std::convert::TryFrom;
use std::error::Error; use std::error::Error;
use url::Url; use url::Url;
use serde::{Deserialize, Serialize};
use crate::task::Task; use crate::task::Task;
use crate::task::TaskId; use crate::task::TaskId;
@ -9,6 +10,7 @@ use crate::task::TaskId;
use bitflags::bitflags; use bitflags::bitflags;
bitflags! { bitflags! {
#[derive(Serialize, Deserialize)]
pub struct SupportedComponents: u8 { pub struct SupportedComponents: u8 {
/// An event, such as a calendar meeting /// An event, such as a calendar meeting
const EVENT = 1; const EVENT = 1;
@ -45,7 +47,7 @@ impl TryFrom<minidom::Element> for SupportedComponents {
/// A Caldav Calendar /// A Caldav Calendar
#[derive(Clone, Debug)] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Calendar { pub struct Calendar {
name: String, name: String,
url: Url, url: Url,

4
src/task.rs

@ -1,7 +1,9 @@
use serde::{Deserialize, Serialize};
pub type TaskId = String; // This is an HTML "etag" pub type TaskId = String; // This is an HTML "etag"
/// A to-do task /// A to-do task
#[derive(Clone, Debug)] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Task { pub struct Task {
id: TaskId, id: TaskId,
name: String, name: String,

Loading…
Cancel
Save