Crate feed

Source
Expand description

§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();
}

Modules§

channel
All the structs for channels.
extension
All the extensions for Channel

Structs§

CategoryBuilder
This CategoryBuilder struct creates the Category.
ChannelBuilder
This ChannelBuilder struct creates the Channel.
CloudBuilder
This CloudBuilder struct creates the Cloud.
EnclosureBuilder
This EnclosureBuilder struct creates the Enclosure.
GuidBuilder
This GuidBuilder struct creates the Guid.
ImageBuilder
This ImageBuilder struct creates the Image.
ItemBuilder
This ItemBuilder struct creates the Item.
SourceBuilder
This SourceBuilder struct creates the Source.
TextInputBuilder
This TextInputBuilder struct creates the TextInput.

Traits§

CategoryGetters
The Getter functions for Category
ChannelGetters
The Getter functions for Channel
CloudGetters
The Getter functions for Cloud
EnclosureGetters
The Getter functions for Enclosure
FromUrl
From Url function for Channel
GuidGetters
The Getter functions for Guid
ImageGetters
The Getter functions for Image
ItemGetters
The Getter functions for Item
SourceGetters
The Getter functions for Source
TextInputGetters
The Getter functions for TextInput
Validate
Validate function for Channel