[−][src]Struct rss::Channel
Represents the channel of an RSS feed.
Fields
title: String
The name of the channel.
link: String
The URL for the website corresponding to the channel.
description: String
A description of the channel.
language: Option<String>
The language of the channel.
copyright: Option<String>
The copyright notice for the channel.
managing_editor: Option<String>
The email address for the managing editor.
webmaster: Option<String>
The email address for the webmaster.
pub_date: Option<String>
The publication date for the content of the channel as an RFC822 timestamp.
last_build_date: Option<String>
The date that the contents of the channel last changed as an RFC822 timestamp.
categories: Vec<Category>
The categories the channel belongs to.
generator: Option<String>
A string indicating the program used to generate the channel.
docs: Option<String>
A URL that points to the documentation for the RSS format.
cloud: Option<Cloud>
The cloud to register with to be notified of updates to the channel.
rating: Option<String>
The PICS rating for the channel.
ttl: Option<String>
The number of minutes the channel can be cached before refreshing.
image: Option<Image>
An image that can be displayed with the channel.
text_input: Option<TextInput>
A text input box that can be displayed with the channel.
skip_hours: Vec<String>
A hint to tell the aggregator which hours it can skip.
skip_days: Vec<String>
A hint to tell the aggregator which days it can skip.
items: Vec<Item>
The items in the channel.
extensions: ExtensionMap
The extensions for the channel.
itunes_ext: Option<ITunesChannelExtension>
The iTunes extension for the channel.
dublin_core_ext: Option<DublinCoreExtension>
The Dublin Core extension for the channel.
The Syndication extension for the channel.
namespaces: HashMap<String, String>
The namespaces present in the RSS tag.
Implementations
impl Channel
[src]
pub fn title(&self) -> &str
[src]
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");
pub fn set_title<V>(&mut self, title: V) where
V: Into<String>,
[src]
V: Into<String>,
Set the title of this channel.
Examples
use rss::Channel; let mut channel = Channel::default(); channel.set_title("Channel Title");
pub fn link(&self) -> &str
[src]
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");
pub fn set_link<V>(&mut self, link: V) where
V: Into<String>,
[src]
V: Into<String>,
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");
pub fn description(&self) -> &str
[src]
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");
pub fn set_description<V>(&mut self, description: V) where
V: Into<String>,
[src]
V: Into<String>,
Set the description of this channel.
Examples
use rss::Channel; let mut channel = Channel::default(); channel.set_description("Channel description");
pub fn language(&self) -> Option<&str>
[src]
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"));
pub fn set_language<V>(&mut self, language: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the language of this channel.
Examples
use rss::Channel; let mut channel = Channel::default(); channel.set_language("en-US".to_string());
pub fn copyright(&self) -> Option<&str>
[src]
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"));
pub fn set_copyright<V>(&mut self, copyright: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the copyright notice for this channel.
Examples
use rss::Channel; let mut channel = Channel::default(); channel.set_copyright("© 2017 John Doe".to_string());
pub fn managing_editor(&self) -> Option<&str>
[src]
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"));
pub fn set_managing_editor<V>(&mut self, managing_editor: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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"));
pub fn webmaster(&self) -> Option<&str>
[src]
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"));
pub fn set_webmaster<V>(&mut self, webmaster: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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());
pub fn pub_date(&self) -> Option<&str>
[src]
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("Sun, 1 Jan 2017 12:00:00 GMT".to_string()); assert_eq!(channel.pub_date(), Some("Sun, 1 Jan 2017 12:00:00 GMT"));
pub fn set_pub_date<V>(&mut self, pub_date: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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("Sun, 1 Jan 2017 12:00:00 GMT".to_string()); assert_eq!(channel.pub_date(), Some("Sun, 1 Jan 2017 12:00:00 GMT"));
Using chrono::DateTime
use rss::Channel; use chrono::{TimeZone, Utc}; let mut channel = Channel::default(); channel.set_pub_date(Utc.ymd(2017, 1, 1).and_hms(12, 0, 0).to_rfc2822()); assert_eq!(channel.pub_date(), Some("Sun, 01 Jan 2017 12:00:00 +0000"));
pub fn last_build_date(&self) -> Option<&str>
[src]
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("Sun, 1 Jan 2017 12:00:00 GMT".to_string()); assert_eq!(channel.last_build_date(), Some("Sun, 1 Jan 2017 12:00:00 GMT"));
pub fn set_last_build_date<V>(&mut self, last_build_date: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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("Sun, 1 Jan 2017 12:00:00 GMT".to_string()); assert_eq!(channel.last_build_date(), Some("Sun, 1 Jan 2017 12:00:00 GMT"));
Using chrono::DateTime
use rss::Channel; use chrono::{TimeZone, Utc}; let mut channel = Channel::default(); channel.set_last_build_date(Utc.ymd(2017, 1, 1).and_hms(12, 0, 0).to_rfc2822()); assert_eq!(channel.last_build_date(), Some("Sun, 01 Jan 2017 12:00:00 +0000"));
pub fn categories(&self) -> &[Category]
[src]
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);
pub fn categories_mut(&mut self) -> &mut [Category]
[src]
Return a mutable slice of the categories that this channel belongs to.
pub fn set_categories<V>(&mut self, categories: V) where
V: Into<Vec<Category>>,
[src]
V: Into<Vec<Category>>,
Set the categories that this channel belongs to.
Examples
use rss::{Channel, Category}; let mut channel = Channel::default(); channel.set_categories(vec![Category::default()]);
pub fn generator(&self) -> Option<&str>
[src]
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"));
pub fn set_generator<V>(&mut self, generator: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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());
pub fn docs(&self) -> Option<&str>
[src]
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"));
pub fn set_docs<V>(&mut self, docs: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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());
pub fn cloud(&self) -> Option<&Cloud>
[src]
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());
pub fn set_cloud<V>(&mut self, cloud: V) where
V: Into<Option<Cloud>>,
[src]
V: Into<Option<Cloud>>,
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());
pub fn ttl(&self) -> Option<&str>
[src]
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"));
pub fn set_ttl<V>(&mut self, ttl: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
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());
pub fn image(&self) -> Option<&Image>
[src]
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());
pub fn set_image<V>(&mut self, image: V) where
V: Into<Option<Image>>,
[src]
V: Into<Option<Image>>,
Set the image to be displayed with this channel.
Examples
use rss::{Channel, Image}; let mut channel = Channel::default(); channel.set_image(Image::default());
pub fn rating(&self) -> Option<&str>
[src]
Return the PICS rating for this channel.
pub fn set_rating<V>(&mut self, rating: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the PICS rating for this channel.
pub fn text_input(&self) -> Option<&TextInput>
[src]
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());
pub fn set_text_input<V>(&mut self, text_input: V) where
V: Into<Option<TextInput>>,
[src]
V: Into<Option<TextInput>>,
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());
pub fn skip_hours(&self) -> &[String]
[src]
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);
pub fn skip_hours_mut(&mut self) -> &mut [String]
[src]
Return a mutable slice of the hours that aggregators can skip for refreshing content.
pub fn set_skip_hours<V>(&mut self, skip_hours: V) where
V: Into<Vec<String>>,
[src]
V: Into<Vec<String>>,
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()]);
pub fn skip_days(&self) -> &[String]
[src]
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);
pub fn skip_days_mut(&mut self) -> &mut [String]
[src]
Return a mutable slice of the days that aggregators can skip for refreshing content.
pub fn set_skip_days<V>(&mut self, skip_days: V) where
V: Into<Vec<String>>,
[src]
V: Into<Vec<String>>,
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()]);
pub fn items(&self) -> &[Item]
[src]
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);
pub fn items_mut(&mut self) -> &mut [Item]
[src]
Return a mutable slice of the items in this channel.
pub fn into_items(self) -> Vec<Item>
[src]
Consume the Channel
and return a vector of Item
s.
Examples
use rss::{Channel, Item}; let mut channel = Channel::default(); channel.set_items(vec![Item::default()]); assert_eq!(channel.into_items().len(), 1);
pub fn set_items<V>(&mut self, items: V) where
V: Into<Vec<Item>>,
[src]
V: Into<Vec<Item>>,
Set the items in this channel.
Examples
use rss::{Channel, Item}; let mut channel = Channel::default(); channel.set_items(vec![Item::default()]);
pub fn itunes_ext(&self) -> Option<&ITunesChannelExtension>
[src]
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());
pub fn set_itunes_ext<V>(&mut self, itunes_ext: V) where
V: Into<Option<ITunesChannelExtension>>,
[src]
V: Into<Option<ITunesChannelExtension>>,
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());
pub fn dublin_core_ext(&self) -> Option<&DublinCoreExtension>
[src]
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());
pub fn set_dublin_core_ext<V>(&mut self, dublin_core_ext: V) where
V: Into<Option<DublinCoreExtension>>,
[src]
V: Into<Option<DublinCoreExtension>>,
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());
pub fn syndication_ext(&self) -> Option<&SyndicationExtension>
[src]
Return the Syndication extension for this channel.
Examples
use rss::Channel; use rss::extension::syndication::SyndicationExtension; let mut channel = Channel::default(); channel.set_syndication_ext(SyndicationExtension::default()); assert!(channel.syndication_ext().is_some());
pub fn set_syndication_ext<V>(&mut self, syndication_ext: V) where
V: Into<Option<SyndicationExtension>>,
[src]
V: Into<Option<SyndicationExtension>>,
Set the Syndication extension for this channel.
Examples
use rss::Channel; use rss::extension::syndication::SyndicationExtension; let mut channel = Channel::default(); channel.set_syndication_ext(SyndicationExtension::default());
pub fn extensions(&self) -> &ExtensionMap
[src]
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));
pub fn set_extensions<V>(&mut self, extensions: V) where
V: Into<ExtensionMap>,
[src]
V: Into<ExtensionMap>,
Set the extensions for this channel.
Examples
use rss::Channel; use rss::extension::ExtensionMap; let mut channel = Channel::default(); channel.set_extensions(ExtensionMap::default());
pub fn namespaces(&self) -> &HashMap<String, String>
[src]
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(String::as_str), Some("http://example.com"));
pub fn set_namespaces<V>(&mut self, namespaces: V) where
V: Into<HashMap<String, String>>,
[src]
V: Into<HashMap<String, String>>,
Set the namespaces for this channel.
Examples
use std::collections::HashMap; use rss::Channel; let mut channel = Channel::default(); channel.set_namespaces(HashMap::new());
impl Channel
[src]
pub fn read_from<R: BufRead>(reader: R) -> Result<Channel, Error>
[src]
Attempt to read an RSS channel from a reader.
Example
let reader: BufRead = ...; let channel = Channel::read_from(reader).unwrap();
pub fn write_to<W: Write>(&self, writer: W) -> Result<W, Error>
[src]
Attempt to write the RSS channel as XML to a writer.
Example
let channel: Channel = ...; let writer: Write = ...; channel.write_to(writer).unwrap();
pub fn pretty_write_to<W: Write>(
&self,
writer: W,
indent_char: u8,
indent_size: usize
) -> Result<W, Error>
[src]
&self,
writer: W,
indent_char: u8,
indent_size: usize
) -> Result<W, Error>
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();
impl Channel
[src]
pub fn from_xml<R: BufRead>(
namespaces: &HashMap<String, String>,
reader: &mut Reader<R>,
_: Attributes<'_>
) -> Result<Self, Error>
[src]
namespaces: &HashMap<String, String>,
reader: &mut Reader<R>,
_: Attributes<'_>
) -> Result<Self, Error>
Builds a Channel from source XML
Trait Implementations
impl Clone for Channel
[src]
impl Debug for Channel
[src]
impl Default for Channel
[src]
impl FromStr for Channel
[src]
type Err = Error
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Channel, Error>
[src]
impl PartialEq<Channel> for Channel
[src]
impl StructuralPartialEq for Channel
[src]
impl ToString for Channel
[src]
Auto Trait Implementations
impl RefUnwindSafe for Channel
[src]
impl Send for Channel
[src]
impl Sync for Channel
[src]
impl Unpin for Channel
[src]
impl UnwindSafe for Channel
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,