#rss #deprecated #channel #merged #feed #parser #struct

deprecated feed

Deprecated. This project has been merged with the rss crate.

19 stable releases

Uses old Rust 2015

2.1.0 May 26, 2017
2.0.2 Mar 10, 2017
2.0.1 Jan 28, 2017
1.2.4 Sep 16, 2016
1.0.5 Mar 26, 2016

#12 in #merged

Download history 45/week @ 2024-03-29 10/week @ 2024-04-05 1/week @ 2024-05-17

59 downloads per month
Used in liste

LGPL-3.0

200KB
2K SLoC

Deprecated. This project has been merged with the rss crate.


lib.rs:

feed 3.0

This Library is for parsing through a channels field and creating a Feed struct containing all elements of a Channel based on the channels spec.

Usage

Put this in your Cargo.toml:

[dependencies]
feed = "3.0"

And put this in your crate root:

extern crate feed;

Examples

Reading Feeds

extern crate rss;
extern crate feed;

use feed::{FromUrl, ChannelGetters};
use rss::Channel;

fn main()
{
    let url = "https://feedpress.me/usererror.xml";

    let channel = Channel::from_url(url).unwrap();
    println!("Feed Title: {:?}", channel.title());
}

Writing Feeds

extern crate feed;

use feed::ChannelBuilder;

fn main()
{
    let description = "Ogg Vorbis audio versions of The Linux ".to_owned()
        + "Action Show! A show that covers everything geeks care about in "
        + "the computer industry. Get a solid dose of Linux, gadgets, news "
        + "events and much more!";

    let channel = ChannelBuilder::new()
        .title("The Linux Action Show! OGG")
        .link("http://www.jupiterbroadcasting.com")
        .description(description.as_ref())
        .finalize().unwrap();

    println!("Feed: {:?}", channel.to_string());
}

Validating Feeds

extern crate feed;

use feed::ChannelBuilder;

fn main()
{
    let description = "Ogg Vorbis audio versions of The Linux ".to_owned()
        + "Action Show! A show that covers everything geeks care about in "
        + "the computer industry. Get a solid dose of Linux, gadgets, news "
        + "events and much more!";

    let channel = ChannelBuilder::new()
        .title("The Linux Action Show! OGG")
        .link("http://www.jupiterbroadcasting.com")
        .description(description.as_ref())
        .validate().unwrap()
        .finalize().unwrap();

    println!("Feed: {:?}", channel.to_string());
}
extern crate rss;
extern crate feed;

use feed::{FromUrl, Validate};
use rss::Channel;

fn main()
{
    let url = "https://feedpress.me/usererror.xml";

    let channel = Channel::from_url(url).unwrap();
    channel.validate().unwrap();
}

Dependencies

~12–20MB
~319K SLoC