Make Feed fields private.

This commit is contained in:
Jordan Petridis
2017-11-17 16:12:11 +02:00
parent 54a0f17588
commit 3d108d4a7a
3 changed files with 39 additions and 28 deletions
+13 -12
View File
@@ -55,19 +55,20 @@ fn get_temp_db() -> TempDB {
}
fn index_urls(m: &Database) {
URLS.par_iter().for_each(|&(buff, url)| {
// Create and insert a Source into db
let s = {
let temp = m.lock().unwrap();
insert_return_source(&temp, url).unwrap()
};
// parse it into a channel
let chan = rss::Channel::read_from(buff).unwrap();
let feed = Feed(chan, s);
let mut feeds: Vec<_> = URLS.par_iter()
.map(|&(buff, url)| {
// Create and insert a Source into db
let s = {
let temp = m.lock().unwrap();
insert_return_source(&temp, url).unwrap()
};
// parse it into a channel
let chan = rss::Channel::read_from(buff).unwrap();
Feed::new_from_channel_source(chan, s)
})
.collect();
// Index the channel
index_feeds(m, &mut [feed]);
});
index_feeds(m, &mut feeds);
}
#[bench]