Struct rss::Item
[−]
[src]
pub struct Item { /* fields omitted */ }
A representation of the <item>
element.
Methods
impl Item
[src]
fn title(&self) -> Option<&str>
Get the optional title that exists under Item
.
Examples
use rss::{ItemBuilder, Item}; let title_string = "Making Music with Linux | LAS 408"; let item = ItemBuilder::new() .title(Some(title_string.to_string())) .finalize() .unwrap(); assert_eq!(Some(title_string), item.title());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .title(None) .finalize() .unwrap(); assert!(item.title().is_none());
fn link(&self) -> Option<&str>
Get the optional link that exists under Item
.
Examples
use rss::{ItemBuilder, Item}; let link_string = "http://www.jupiterbroadcasting.com/"; let item = ItemBuilder::new() .link(Some(link_string.to_string())) .finalize() .unwrap(); assert_eq!(Some(link_string), item.link());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .link(None) .finalize() .unwrap(); assert!(item.link().is_none());
fn description(&self) -> Option<&str>
Get the optional description that exists under Item
.
Examples
use rss::{ItemBuilder, Item}; let description_string = "This is a test description"; let item = ItemBuilder::new() .description(Some(description_string.to_string())) .finalize() .unwrap(); assert_eq!(Some(description_string), item.description());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .description(None) .finalize() .unwrap(); assert!(item.description().is_none());
Get the optional author that exists under Item
.
Examples
use rss::{ItemBuilder, Item}; let author_string = "Chris Fisher"; let item = ItemBuilder::new() .author(Some(author_string.to_string())) .finalize() .unwrap(); assert_eq!(Some(author_string), item.author());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .author(None) .finalize() .unwrap(); assert!(item.author().is_none());
fn categories(&self) -> &[Category]
Get the categories that exists under Item
.
Examples
use rss::{CategoryBuilder, ItemBuilder, Item}; let category_1 = CategoryBuilder::new() .domain(None) .name("Media") .finalize() .unwrap(); let category_2 = CategoryBuilder::new() .domain(Some("http://jupiterbroadcasting.com".to_string())) .name("Podcast") .finalize() .unwrap(); let categories_vec = vec![category_1, category_2]; let item = ItemBuilder::new() .categories(categories_vec.clone()) .finalize() .unwrap(); assert_eq!(categories_vec.clone().len(), item.categories().len());
fn comments(&self) -> Option<&str>
Get the optional comments that exists under Item
.
Examples
use rss::{ItemBuilder, Item}; let comments_string = "http://example.com/comments"; let item = ItemBuilder::new() .comments(Some(comments_string.to_string())) .finalize() .unwrap(); let comments_option = item.comments(); assert!(comments_option.is_some()); assert_eq!(Some(comments_string), item.comments());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .comments(None) .finalize() .unwrap(); assert!(item.comments().is_none());
fn enclosure(&self) -> Option<&Enclosure>
Get the optional enclosure that exists under Item
.
Examples
use rss::{EnclosureBuilder, ItemBuilder, Item}; let url = "http://www.podtrac.com/pts/redirect.ogg/".to_string() + "traffic.libsyn.com/jnite/linuxactionshowep408.ogg"; let enclosure = EnclosureBuilder::new() .url(url.as_ref()) .length(70772893) .mime_type("audio/ogg") .finalize() .unwrap(); let item = ItemBuilder::new() .enclosure(Some(enclosure)) .finalize() .unwrap(); assert!(item.enclosure().is_some());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .enclosure(None) .finalize() .unwrap(); assert!(item.enclosure().is_none());
fn guid(&self) -> Option<&Guid>
Get the optional guid that exists under Item
.
Examples
use rss::{GuidBuilder, ItemBuilder, Item}; let guid = GuidBuilder::new() .value("9DE46946-2F90-4D5D-9047-7E9165C16E7C") .is_permalink(None) .finalize() .unwrap(); let item = ItemBuilder::new() .guid(Some(guid)) .finalize() .unwrap(); assert!(item.guid().is_some())
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .guid(None) .finalize() .unwrap(); assert!(item.guid().is_none());
fn pub_date(&self) -> Option<&str>
Get the optional pub date that exists under Item
.
Examples
use rss::{ItemBuilder, Item}; let pub_date = "Sun, 13 Mar 2016 20:02:02 -0700"; let item = ItemBuilder::new() .pub_date(Some(pub_date.to_string())) .finalize() .unwrap(); let local = item.pub_date(); assert!(local.is_some()); assert_eq!(pub_date.to_string(), local.unwrap());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .pub_date(None) .finalize() .unwrap(); assert!(item.pub_date().is_none());
fn source(&self) -> Option<&Source>
Get the optional source that exists under Item
.
Examples
use rss::{ItemBuilder, Item, SourceBuilder}; let source = SourceBuilder::new() .url("http://www.tomalak.org/links2.xml") .finalize() .unwrap(); let item = ItemBuilder::new() .source(Some(source)) .finalize() .unwrap(); assert!(item.source().is_some())
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .source(None) .finalize() .unwrap(); assert!(item.source().is_none());
fn itunes_ext(&self) -> Option<&ITunesItemExtension>
Get the optional ITunesItemExtension
under Item
.
Examples
use rss::{ItemBuilder, Item}; use rss::extension::itunes::ITunesItemExtensionBuilder; let itunes_item = ITunesItemExtensionBuilder::new() .author(Some("author".to_string())) .block(Some("block".to_string())) .image(Some("image".to_string())) .duration(Some("duration".to_string())) .explicit(Some("explicit".to_string())) .closed_captioned(Some("closed_captioned".to_string())) .order(Some("order".to_string())) .subtitle(Some("subtitle".to_string())) .summary(Some("summary".to_string())) .keywords(Some("keywords".to_string())) .finalize() .unwrap(); let item = ItemBuilder::new() .title(Some("Making Music with Linux | LAS 408".to_string())) .itunes_ext(Some(itunes_item)) .finalize() .unwrap(); assert!(item.itunes_ext().is_some());
use rss::{ItemBuilder, Item}; let item = ItemBuilder::new() .title(Some("Making Music with Linux | LAS 408".to_string())) .itunes_ext(None) .finalize() .unwrap(); assert!(item.itunes_ext().is_none());
fn dublin_core_ext(&self) -> Option<&DublinCoreExtension>
Get the optional DublinCoreExtension
under Item
.
fn extensions(&self) -> &ExtensionMap
Get the ExtensionMap
under Item
.
fn content(&self) -> Option<&str>
Get the optional content under Item
.
Trait Implementations
impl Debug for Item
[src]
impl Default for Item
[src]
impl Clone for Item
[src]
fn clone(&self) -> Item
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more