Crate rss [] [src]

Library for serializing the RSS web content syndication format.

Reading

From a Reader

A channel can be read from any object that implements the BufRead trait.

use std::fs::File;
use std::io::BufReader;
use rss::Channel;

let file = File::open("example.xml").unwrap();
let channel = Channel::read_from(BufReader::new(file)).unwrap();

From a URL

A channel can also be read from a URL.

Note: This requires enabling the from_url feature.

Be careful when using this code, it's not being tested!
use rss::Channel;

let channel = Channel::from_url("http://example.com/feed.xml").unwrap();

Writing

A channel can be written to any object that implements the Write trait or converted to an XML string using the ToString trait.

Note: Writing a channel does not perform any escaping of XML entities.

use rss::Channel;

let channel = Channel::default();
channel.write_to(::std::io::sink()).unwrap(); // write to the channel to a writer
let string = channel.to_string(); // convert the channel to a string

Creation

Builder methods are provided to assist in the creation of channels.

use rss::ChannelBuilder;

let channel = ChannelBuilder::default()
    .title("Channel Title")
    .link("http://example.com")
    .description("An RSS feed.")
    .build()
    .unwrap();

Validation

Validation methods are provided to validate the contents of a channel against the RSS specification.

Note: This requires enabling the validation feature.

Be careful when using this code, it's not being tested!
use rss::Channel;
use rss::validation::Validate;

let channel = Channel::default();
channel.validate().unwrap();

Modules

extension

Types and methods for namespaced extensions.

Structs

Category

Represents a category in an RSS feed.

CategoryBuilder

Builder for Category.

Channel

Represents the channel of an RSS feed.

ChannelBuilder

Builder for Channel.

Cloud

Represents a cloud in an RSS feed.

CloudBuilder

Builder for Cloud.

Enclosure

Represents an enclosure in an RSS item.

EnclosureBuilder

Builder for Enclosure.

Guid

Represents the GUID of an RSS item.

GuidBuilder

Builder for Guid.

Image

Represents an image in an RSS feed.

ImageBuilder

Builder for Image.

Item

Represents an item in an RSS feed.

ItemBuilder

Builder for Item.

Source

Represents the source of an RSS item.

SourceBuilder

Builder for Source.

TextInput

Represents a text input for an RSS channel.

TextInputBuilder

Builder for TextInput.

Enums

Error

Errors that occur during parsing.