diff --git a/src/entry.rs b/src/entry.rs index 4ec8742..e9cb3dc 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -1,10 +1,9 @@ -extern crate atom_syndication; -extern crate rss; -extern crate chrono; +use atom_syndication; +use rss; use chrono::{DateTime, UTC}; use category::Category; -use link::Link; +use atom_syndication::Link; enum EntryData { Atom(atom_syndication::Entry), @@ -59,7 +58,7 @@ impl From for Entry { content: entry.content, links: entry.links .into_iter() - .map(|link| Link { href: link.href }) + .map(|link| link.into()) .collect::>(), // TODO: Implement the Category type for converting this categories: vec![], diff --git a/src/feed.rs b/src/feed.rs index 290943c..d5d1462 100644 --- a/src/feed.rs +++ b/src/feed.rs @@ -1,12 +1,11 @@ -extern crate atom_syndication; -extern crate rss; -extern crate chrono; +use atom_syndication; +use rss; use std::str::FromStr; use chrono::{DateTime, UTC}; +use atom_syndication::{Link, Person}; use category::Category; -use link::Link; use entry::Entry; enum FeedData { @@ -45,12 +44,11 @@ pub struct Feed { pub links: Vec, // `categories` in both Atom and RSS pub categories: Vec, - // TODO: Define our own Person type for API stability reasons // TODO: Should the `web_master` be in `contributors`, `authors`, or at all? // `authors` in Atom, `managing_editor` in RSS (produces 1 item Vec) - pub authors: Vec, + pub authors: Vec, // `contributors` in Atom, `web_master` in RSS (produces a 1 item Vec) - pub contributors: Vec, + pub contributors: Vec, // `entries` in Atom, and `items` in RSS // TODO: Add more fields that are necessary for RSS // TODO: Fancy translation, e.g. Atom = RSS `source` @@ -71,11 +69,7 @@ impl From for Feed { icon: feed.icon, image: feed.logo, // NOTE: We throw away the generator field - // TODO: Add more fields to the link type - links: feed.links - .into_iter() - .map(|link| Link { href: link.href }) - .collect::>(), + links: feed.links, // TODO: Handle this once the Category type is defined categories: vec![], authors: feed.authors, @@ -106,10 +100,7 @@ impl From for atom_syndication::Feed { icon: feed.icon, logo: feed.image, generator: None, - links: feed.links - .into_iter() - .map(|link| atom_syndication::Link { href: link.href, ..Default::default() }) - .collect::>(), + links: feed.links, // TODO: Convert from our Category type instead of throwing them away categories: vec![], authors: feed.authors, diff --git a/src/lib.rs b/src/lib.rs index 0367cd6..34aeef7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,13 +3,13 @@ extern crate rss; extern crate chrono; mod category; -mod link; mod person; mod entry; mod feed; +pub use ::atom_syndication::Link; + pub use ::category::Category; -pub use ::link::Link; pub use ::person::Person; pub use ::entry::Entry; pub use ::feed::Feed; diff --git a/src/link.rs b/src/link.rs deleted file mode 100644 index 17fb5ab..0000000 --- a/src/link.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub struct Link { - pub href: String, -}