1- extern crate atom_syndication;
2- extern crate rss;
3- extern crate chrono;
1+ use atom_syndication;
2+ use rss;
43
54use std:: str:: FromStr ;
65use chrono:: { DateTime , UTC } ;
6+ use atom_syndication:: { Link , Person } ;
77
88use category:: Category ;
9- use link:: Link ;
109use entry:: Entry ;
1110
1211enum FeedData {
@@ -45,12 +44,11 @@ pub struct Feed {
4544 pub links : Vec < Link > ,
4645 // `categories` in both Atom and RSS
4746 pub categories : Vec < Category > ,
48- // TODO: Define our own Person type for API stability reasons
4947 // TODO: Should the `web_master` be in `contributors`, `authors`, or at all?
5048 // `authors` in Atom, `managing_editor` in RSS (produces 1 item Vec)
51- pub authors : Vec < atom_syndication :: Person > ,
49+ pub authors : Vec < Person > ,
5250 // `contributors` in Atom, `web_master` in RSS (produces a 1 item Vec)
53- pub contributors : Vec < atom_syndication :: Person > ,
51+ pub contributors : Vec < Person > ,
5452 // `entries` in Atom, and `items` in RSS
5553 // TODO: Add more fields that are necessary for RSS
5654 // TODO: Fancy translation, e.g. Atom <link rel="via"> = RSS `source`
@@ -71,11 +69,7 @@ impl From<atom_syndication::Feed> for Feed {
7169 icon : feed. icon ,
7270 image : feed. logo ,
7371 // NOTE: We throw away the generator field
74- // TODO: Add more fields to the link type
75- links : feed. links
76- . into_iter ( )
77- . map ( |link| Link { href : link. href } )
78- . collect :: < Vec < _ > > ( ) ,
72+ links : feed. links ,
7973 // TODO: Handle this once the Category type is defined
8074 categories : vec ! [ ] ,
8175 authors : feed. authors ,
@@ -106,10 +100,7 @@ impl From<Feed> for atom_syndication::Feed {
106100 icon : feed. icon ,
107101 logo : feed. image ,
108102 generator : None ,
109- links : feed. links
110- . into_iter ( )
111- . map ( |link| atom_syndication:: Link { href : link. href , ..Default :: default ( ) } )
112- . collect :: < Vec < _ > > ( ) ,
103+ links : feed. links ,
113104 // TODO: Convert from our Category type instead of throwing them away
114105 categories : vec ! [ ] ,
115106 authors : feed. authors ,
0 commit comments