hermod

A rust futures-based RSS/Atom library

4 releases

0.1.3 Jan 2, 2019
0.1.2 Nov 7, 2018
0.1.1 Oct 27, 2018
0.1.0 Oct 27, 2018

#6 in #rss

Download history 14/week @ 2018-10-29 14/week @ 2018-11-05 19/week @ 2018-11-12 16/week @ 2018-11-19 6/week @ 2018-11-26 3/week @ 2018-12-03 8/week @ 2018-12-10 5/week @ 2018-12-17 13/week @ 2018-12-24 12/week @ 2019-01-07

36 downloads per month

MIT license

11KB
238 lines

Hermod

A futures-based RSS-reading library for rust.

To use

To fetch a feed

extern crate hermod;

use hermod::models::Feed;
use hermod::futures::fetch_feed;

fn get_a_feed(url: &str) {
  fetch_feed(url)
    .and_then(|feed| {
      let channel = feed.channel;
      let title = channel.title;
    });
}

To start a loop that will fetch several feeds, and run a custom func for each feed with the resulting Feed

extern crate hermod;

use std::sync::{Arc, Mutex};

use hermod::models::Feed;
use hermod::futures::start_fetch_loop;

fn automatically_fetch_feeds() {
  let interval = 300; // seconds
  let feeds = vec![
    "https://lorem-rss.herokuapp.com/feed".to_owned(),
    "https://feeds.feedburner.com/cyclingtipsblog/TJog".to_owned(),
  ];
  let feed_state = Arc::new(Mutex::new(feeds)); // thread-safe Vec of strings
  
  let func = |feed: Feed| println!("updated feed: {}", feed.channel.title); // func to run for each updated feed
  
  let work = start_fetch_loop(feed_state, interval, func);
  tokio::run(work);
}

Dependencies

~15MB
~389K SLoC