Struct rss::Channel

source ·
pub struct Channel { /* private fields */ }
Expand description

Represents the channel of an RSS feed.

Implementations

Return the title of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_title("Channel Title");
assert_eq!(channel.title(), "Channel Title");

Set the title of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_title("Channel Title");

Return the URL for the website corresponding to this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_link("http://example.com");
assert_eq!(channel.link(), "http://example.com");

Set the URL for the website corresponding to this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_link("http://example.com");

Return the description of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_description("Channel description");
assert_eq!(channel.description(), "Channel description");

Set the description of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_description("Channel description");

Return the language of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_language("en-US".to_string());
assert_eq!(channel.language(), Some("en-US"));

Set the language of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_language("en-US".to_string());

Return the copyright notice for this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_copyright("© 2017 John Doe".to_string());
assert_eq!(channel.copyright(), Some("© 2017 John Doe"));

Set the copyright notice for this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_copyright("© 2017 John Doe".to_string());

Return the email address for the managing editor of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_managing_editor("johndoe@example.com".to_string());
assert_eq!(channel.managing_editor(), Some("johndoe@example.com"));

Set the email address for the managing editor of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_managing_editor("johndoe@example.com".to_string());
assert_eq!(channel.managing_editor(), Some("johndoe@example.com"));

Return the email address for webmaster of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_webmaster("johndoe@example.com".to_string());
assert_eq!(channel.webmaster(), Some("johndoe@example.com"));

Set the email address for webmaster of this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_webmaster("johndoe@example.com".to_string());

Return the publication date for the content of this channel as an RFC822 timestamp.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_pub_date("Mon, 1 Jan 2017 12:00:00 GMT".to_string());
assert_eq!(channel.pub_date(), Some("Mon, 1 Jan 2017 12:00:00 GMT"));

Set the publication date for the content of this channel as an RFC822 timestamp.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_pub_date("Mon, 1 Jan 2017 12:00:00 GMT".to_string());

Return the time that the content of this channel was last changed as an RFC822 timestamp.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_last_build_date("Mon, 1 Jan 2017 12:00:00 GMT".to_string());
assert_eq!(channel.last_build_date(), Some("Mon, 1 Jan 2017 12:00:00 GMT"));

Set the time that the content of this channel was last changed as an RFC822 timestamp.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_last_build_date("Mon, 1 Jan 2017 12:00:00 GMT".to_string());

Return the categories that this channel belongs to.

Examples
use rss::{Channel, Category};

let mut channel = Channel::default();
channel.set_categories(vec![Category::default()]);
assert_eq!(channel.categories().len(), 1);

Return a mutable slice of the categories that this channel belongs to.

Set the categories that this channel belongs to.

Examples
use rss::{Channel, Category};

let mut channel = Channel::default();
channel.set_categories(vec![Category::default()]);

Return a string indicating the program used to generate the channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_generator("Program Name".to_string());
assert_eq!(channel.generator(), Some("Program Name"));

Set a string indicating the program used to generate the channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_generator("Program Name".to_string());

Return a URL that points to the documentation of the RSS format used in this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_docs("https://cyber.harvard.edu/rss/rss.html".to_string());
assert_eq!(channel.docs(), Some("https://cyber.harvard.edu/rss/rss.html"));

Set a URL that points to the documentation of the RSS format used in this channel.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_docs("https://cyber.harvard.edu/rss/rss.html".to_string());

Return the information used to register with a cloud for notifications of updates to the channel.

Examples
use rss::{Channel, Cloud};

let mut channel = Channel::default();
channel.set_cloud(Cloud::default());
assert!(channel.cloud().is_some());

Set the information used to register with a cloud for notifications of updates to the channel.

Examples
use rss::{Channel, Cloud};

let mut channel = Channel::default();
channel.set_cloud(Cloud::default());

Return the time to live of this channel. This indicates the number of minutes the channel can be cached before needing to be refreshed.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_ttl("60".to_string());
assert_eq!(channel.ttl(), Some("60"));

Set the time to live of this channel. This indicates the number of minutes the channel can be cached before needing to be refreshed.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_ttl("60".to_string());

Return the image to be displayed with this channel.

Examples
use rss::{Channel, Image};

let mut channel = Channel::default();
channel.set_image(Image::default());
assert!(channel.image().is_some());

Set the image to be displayed with this channel.

Examples
use rss::{Channel, Image};

let mut channel = Channel::default();
channel.set_image(Image::default());

Return the PICS rating for this channel.

Set the PICS rating for this channel.

Return the information for a text box to be displayed with this channel.

Examples
use rss::{Channel, TextInput};

let mut channel = Channel::default();
channel.set_text_input(TextInput::default());
assert!(channel.text_input().is_some());

Set the information for a text box to be displayed with this channel.

Examples
use rss::{Channel, TextInput};

let mut channel = Channel::default();
channel.set_text_input(TextInput::default());

Return the hours that aggregators can skip for refreshing content.

Examples
use rss::Channel;

let skip_hours = vec![6, 7, 8, 14, 22];

let mut channel = Channel::default();
channel.set_skip_hours(vec!["1".to_string()]);
assert_eq!(channel.skip_hours().len(), 1);

Return a mutable slice of the hours that aggregators can skip for refreshing content.

Set the hours that aggregators can skip for refreshing content.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_skip_hours(vec!["1".to_string()]);

Return the days that aggregators can skip for refreshing content.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_skip_days(vec!["Monday".to_string()]);
assert_eq!(channel.skip_days().len(), 1);

Return a mutable slice of the days that aggregators can skip for refreshing content.

Set the days that aggregators can skip for refreshing content.

Examples
use rss::Channel;

let mut channel = Channel::default();
channel.set_skip_days(vec!["Monday".to_string()]);

Return the items in this channel.

Examples
use rss::{Channel, Item};

let mut channel = Channel::default();
channel.set_items(vec![Item::default()]);
assert_eq!(channel.items().len(), 1);

Return a mutable slice of the items in this channel.

Consume the Channel and return a vector of Items.

Examples
use rss::{Channel, Item};

let mut channel = Channel::default();
channel.set_items(vec![Item::default()]);
assert_eq!(channel.into_items().len(), 1);

Set the items in this channel.

Examples
use rss::{Channel, Item};

let mut channel = Channel::default();
channel.set_items(vec![Item::default()]);

Return the iTunes extension for this channel.

Examples
use rss::Channel;
use rss::extension::itunes::ITunesChannelExtension;

let mut channel = Channel::default();
channel.set_itunes_ext(ITunesChannelExtension::default());
assert!(channel.itunes_ext().is_some());

Set the iTunes extension for this channel.

Examples
use rss::Channel;
use rss::extension::itunes::ITunesChannelExtension;

let mut channel = Channel::default();
channel.set_itunes_ext(ITunesChannelExtension::default());

Return the Dublin Core extension for this channel.

Examples
use rss::Channel;
use rss::extension::dublincore::DublinCoreExtension;

let mut channel = Channel::default();
channel.set_dublin_core_ext(DublinCoreExtension::default());
assert!(channel.dublin_core_ext().is_some());

Set the Dublin Core extension for this channel.

Examples
use rss::Channel;
use rss::extension::dublincore::DublinCoreExtension;

let mut channel = Channel::default();
channel.set_dublin_core_ext(DublinCoreExtension::default());

Return the extensions for this channel.

Examples
use std::collections::HashMap;
use rss::Channel;
use rss::extension::{ExtensionMap, Extension};

let extension = Extension::default();

let mut item_map = HashMap::<String, Vec<Extension>>::new();
item_map.insert("ext:name".to_string(), vec![extension]);

let mut extension_map = ExtensionMap::default();
extension_map.insert("ext".to_string(), item_map);

let mut channel = Channel::default();
channel.set_extensions(extension_map);
assert_eq!(channel.extensions()
                  .get("ext")
                  .and_then(|m| m.get("ext:name"))
                  .map(|v| v.len()),
           Some(1));

Set the extensions for this channel.

Examples
use rss::Channel;
use rss::extension::ExtensionMap;

let mut channel = Channel::default();
channel.set_extensions(ExtensionMap::default());

Return the namespaces for this channel.

Examples
use std::collections::HashMap;
use rss::Channel;

let mut namespaces = HashMap::new();
namespaces.insert("ext".to_string(), "http://example.com".to_string());

let mut channel = Channel::default();
channel.set_namespaces(namespaces);
assert_eq!(channel.namespaces().get("ext").map(|s| s.as_str()), Some("http://example.com"));

Set the namespaces for this channel.

Examples
use std::collections::HashMap;
use rss::Channel;

let mut channel = Channel::default();
channel.set_namespaces(HashMap::new());

Attempt to read an RSS channel from a reader.

Example
let reader: BufRead = ...;
let channel = Channel::read_from(reader).unwrap();

Attempt to write the RSS channel as XML to a writer.

Example
let channel: Channel = ...;
let writer: Write = ...;
channel.write_to(writer).unwrap();

Attempt to write the RSS channel as pretty XML to a writer.

Example
let channel: Channel = ...;
let writer: Write = ...;
channel.pretty_write_to(writer, b' ', 2).unwrap();

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Converts the given value to a String. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.