diff --git a/src/category.rs b/src/category.rs index 2be7afa..2dd3c03 100644 --- a/src/category.rs +++ b/src/category.rs @@ -1,6 +1,7 @@ use atom_syndication as atom; use rss; +#[derive(Debug, PartialEq, Eq, Clone)] pub struct Category { pub term: String, pub scheme: Option, diff --git a/src/entry.rs b/src/entry.rs index 130232b..c588898 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -2,6 +2,7 @@ use atom_syndication as atom; use rss; use std::str::FromStr; +use std::fmt::{Formatter, Debug, Error}; use chrono::{DateTime, UTC}; use category::Category; @@ -9,11 +10,22 @@ use link::Link; use person::Person; use guid::Guid; +#[derive(Clone)] enum EntryData { Atom(atom::Entry), Rss(rss::Item), } +impl Debug for EntryData { + fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { + match *self { + EntryData::Atom(_) => write!(f, "Atom(_)"), + EntryData::Rss(_) => write!(f, "Rss(_)"), + } + } +} + +#[derive(Debug, Clone)] pub struct Entry { // If created from an Atom or RSS entry, this is the original contents source_data: Option, diff --git a/src/feed.rs b/src/feed.rs index d8132ad..af68144 100644 --- a/src/feed.rs +++ b/src/feed.rs @@ -2,6 +2,7 @@ use atom_syndication as atom; use rss; use std::str::FromStr; +use std::fmt::{Debug, Formatter, Error}; use chrono::{DateTime, UTC}; use link::Link; @@ -12,13 +13,24 @@ use entry::Entry; use image::Image; use text_input::TextInput; +#[derive(Clone)] enum FeedData { Atom(atom::Feed), Rss(rss::Channel), } +impl Debug for FeedData { + fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { + match *self { + FeedData::Atom(_) => write!(f, "Atom(_)"), + FeedData::Rss(_) => write!(f, "Rss(_)"), + } + } +} + // A helpful table of approximately equivalent elements can be found here: // http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared#table +#[derive(Debug, Clone)] pub struct Feed { // If created from an RSS or Atom feed, this is the original contents source_data: Option, diff --git a/src/generator.rs b/src/generator.rs index 1fa4a06..a8da791 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -1,5 +1,6 @@ use atom_syndication as atom; +#[derive(Debug, PartialEq, Eq, Clone)] pub struct Generator { pub name: String, pub uri: Option, diff --git a/src/guid.rs b/src/guid.rs index 43ac5a1..5bf23f8 100644 --- a/src/guid.rs +++ b/src/guid.rs @@ -1,5 +1,6 @@ use rss; +#[derive(Debug, PartialEq, Eq, Clone)] pub struct Guid { pub is_permalink: bool, pub id: String, diff --git a/src/image.rs b/src/image.rs index fcbfb4a..7954b8c 100644 --- a/src/image.rs +++ b/src/image.rs @@ -1,5 +1,6 @@ use rss; +#[derive(Debug, PartialEq, Eq, Clone)] pub struct Image { pub url: String, pub title: String, diff --git a/src/link.rs b/src/link.rs index d1e7765..289de9a 100644 --- a/src/link.rs +++ b/src/link.rs @@ -1,5 +1,6 @@ use atom_syndication as atom; +#[derive(Debug, PartialEq, Eq, Clone)] pub struct Link { pub href: String, pub rel: Option, diff --git a/src/person.rs b/src/person.rs index 409f278..53816e8 100644 --- a/src/person.rs +++ b/src/person.rs @@ -1,5 +1,6 @@ use atom_syndication as atom; +#[derive(Debug, PartialEq, Clone)] pub struct Person { pub name: String, pub uri: Option, diff --git a/src/text_input.rs b/src/text_input.rs index 5f4a4e7..5fccfc4 100644 --- a/src/text_input.rs +++ b/src/text_input.rs @@ -1,5 +1,6 @@ use rss; +#[derive(Debug, PartialEq, Eq, Clone)] pub struct TextInput { pub title: String, pub description: String,