[−][src]Struct atom_syndication::Feed
Represents an Atom feed
Fields
title: String
A human-readable title for the feed.
id: String
A universally unique and permanent URI.
updated: FixedDateTime
The last time the feed was modified in a significant way.
The authors of the feed.
categories: Vec<Category>
The categories that the feed belongs to.
contributors: Vec<Person>
The contributors to the feed.
generator: Option<Generator>
The software used to generate the feed.
icon: Option<String>
A small image which provides visual identification for the feed.
links: Vec<Link>
The Web pages related to the feed.
logo: Option<String>
A larger image which provides visual identification for the feed.
rights: Option<String>
Information about rights held in and over the feed.
subtitle: Option<String>
A human-readable description or subtitle for the feed.
entries: Vec<Entry>
The entries contained in the feed.
extensions: ExtensionMap
The extensions for the feed.
namespaces: HashMap<String, String>
The namespaces present in the feed tag.
Implementations
impl Feed
[src]
pub fn read_from<B: BufRead>(reader: B) -> Result<Feed, Error>
[src]
Attempt to read an Atom feed from the reader.
Examples
use std::io::BufReader; use std::fs::File; use atom_syndication::Feed; let file = File::open("example.xml").unwrap(); let feed = Feed::read_from(BufReader::new(file)).unwrap();
pub fn write_to<W: Write>(&self, writer: W) -> Result<W, Error>
[src]
Attempt to write this Atom feed to a writer.
Examples
use std::io::BufReader; use std::fs::File; use atom_syndication::Feed; let file = File::open("example.xml").unwrap(); let feed = Feed::read_from(BufReader::new(file)).unwrap(); let out = File::create("out.xml").unwrap(); feed.write_to(out).unwrap();
pub fn title(&self) -> &str
[src]
Return the title of this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_title("Feed Title"); assert_eq!(feed.title(), "Feed Title");
pub fn set_title<V>(&mut self, title: V) where
V: Into<String>,
[src]
V: Into<String>,
Set the title of this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_title("Feed Title");
pub fn id(&self) -> &str
[src]
Return the unique URI of this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_id("urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6"); assert_eq!(feed.id(), "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
pub fn set_id<V>(&mut self, id: V) where
V: Into<String>,
[src]
V: Into<String>,
Set the unique URI of this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_id("urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
pub fn updated(&self) -> &FixedDateTime
[src]
Return the last time that this feed was modified.
Examples
use atom_syndication::Feed; use atom_syndication::FixedDateTime; use std::str::FromStr; let mut feed = Feed::default(); feed.set_updated(FixedDateTime::from_str("2017-06-03T15:15:44-05:00").unwrap()); assert_eq!(feed.updated().to_rfc3339(), "2017-06-03T15:15:44-05:00");
pub fn set_updated<V>(&mut self, updated: V) where
V: Into<FixedDateTime>,
[src]
V: Into<FixedDateTime>,
Set the last time that this feed was modified.
Examples
use atom_syndication::Feed; use atom_syndication::FixedDateTime; use std::str::FromStr; let mut feed = Feed::default(); feed.set_updated(FixedDateTime::from_str("2017-06-03T15:15:44-05:00").unwrap());
pub fn authors(&self) -> &[Person]
[src]
Return the authors of this feed.
Examples
use atom_syndication::{Feed, Person}; let mut feed = Feed::default(); feed.set_authors(vec![Person::default()]); assert_eq!(feed.authors().len(), 1);
pub fn set_authors<V>(&mut self, authors: V) where
V: Into<Vec<Person>>,
[src]
V: Into<Vec<Person>>,
Set the authors of this feed.
Examples
use atom_syndication::{Feed, Person}; let mut feed = Feed::default(); feed.set_authors(vec![Person::default()]);
pub fn categories(&self) -> &[Category]
[src]
Return the categories this feed belongs to.
Examples
use atom_syndication::{Feed, Category}; let mut feed = Feed::default(); feed.set_categories(vec![Category::default()]); assert_eq!(feed.categories().len(), 1);
pub fn set_categories<V>(&mut self, categories: V) where
V: Into<Vec<Category>>,
[src]
V: Into<Vec<Category>>,
Set the categories this feed belongs to.
Examples
use atom_syndication::{Feed, Category}; let mut feed = Feed::default(); feed.set_categories(vec![Category::default()]);
pub fn contributors(&self) -> &[Person]
[src]
Return the contributors to this feed.
Examples
use atom_syndication::{Feed, Person}; let mut feed = Feed::default(); feed.set_contributors(vec![Person::default()]); assert_eq!(feed.contributors().len(), 1);
pub fn set_contributors<V>(&mut self, contributors: V) where
V: Into<Vec<Person>>,
[src]
V: Into<Vec<Person>>,
Set the contributors to this feed.
Examples
use atom_syndication::{Feed, Person}; let mut feed = Feed::default(); feed.set_contributors(vec![Person::default()]);
pub fn generator(&self) -> Option<&Generator>
[src]
Return the name of the software used to generate this feed.
Examples
use atom_syndication::{Feed, Generator}; let mut feed = Feed::default(); feed.set_generator(Generator::default()); assert!(feed.generator().is_some());
pub fn set_generator<V>(&mut self, generator: V) where
V: Into<Option<Generator>>,
[src]
V: Into<Option<Generator>>,
Set the name of the software used to generate this feed.
Examples
use atom_syndication::{Feed, Generator}; let mut feed = Feed::default(); feed.set_generator(Generator::default());
pub fn icon(&self) -> Option<&str>
[src]
Return the icon for this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_icon("http://example.com/icon.png".to_string()); assert_eq!(feed.icon(), Some("http://example.com/icon.png"));
pub fn set_icon<V>(&mut self, icon: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the icon for this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_icon("http://example.com/icon.png".to_string());
pub fn links(&self) -> &[Link]
[src]
Return the Web pages related to this feed.
Examples
use atom_syndication::{Feed, Link}; let mut feed = Feed::default(); feed.set_links(vec![Link::default()]); assert_eq!(feed.links().len(), 1);
pub fn set_links<V>(&mut self, links: V) where
V: Into<Vec<Link>>,
[src]
V: Into<Vec<Link>>,
Set the Web pages related to this feed.
Examples
use atom_syndication::{Feed, Link}; let mut feed = Feed::default(); feed.set_links(vec![Link::default()]);
pub fn logo(&self) -> Option<&str>
[src]
Return the logo for this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_logo("http://example.com/logo.png".to_string()); assert_eq!(feed.logo(), Some("http://example.com/logo.png"));
pub fn set_logo<V>(&mut self, logo: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the logo for this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_logo("http://example.com/logo.png".to_string());
pub fn rights(&self) -> Option<&str>
[src]
Return the information about the rights held in and over this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_rights("© 2017 John Doe".to_string()); assert_eq!(feed.rights(), Some("© 2017 John Doe"));
pub fn set_rights<V>(&mut self, rights: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the information about the rights held in and over this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_rights("© 2017 John Doe".to_string());
pub fn subtitle(&self) -> Option<&str>
[src]
Return the description or subtitle of this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_subtitle("Feed subtitle".to_string()); assert_eq!(feed.subtitle(), Some("Feed subtitle"));
pub fn set_subtitle<V>(&mut self, subtitle: V) where
V: Into<Option<String>>,
[src]
V: Into<Option<String>>,
Set the description or subtitle of this feed.
Examples
use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_subtitle("Feed subtitle".to_string());
pub fn entries(&self) -> &[Entry]
[src]
Return the entries in this feed.
Examples
use atom_syndication::{Feed, Entry}; let mut feed = Feed::default(); feed.set_entries(vec![Entry::default()]); assert_eq!(feed.entries().len(), 1);
pub fn set_entries<V>(&mut self, entries: V) where
V: Into<Vec<Entry>>,
[src]
V: Into<Vec<Entry>>,
Set the entries in this feed.
Examples
use atom_syndication::{Feed, Entry}; let mut feed = Feed::default(); feed.set_entries(vec![Entry::default()]);
pub fn extensions(&self) -> &ExtensionMap
[src]
Return the extensions for this feed.
Examples
use std::collections::HashMap; use atom_syndication::Feed; use atom_syndication::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 feed = Feed::default(); feed.set_extensions(extension_map); assert_eq!(feed.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 feed.
Examples
use atom_syndication::Feed; use atom_syndication::extension::ExtensionMap; let mut feed = Feed::default(); feed.set_extensions(ExtensionMap::default());
pub fn namespaces(&self) -> &HashMap<String, String>
[src]
Return the namespaces for this feed.
Examples
use std::collections::HashMap; use atom_syndication::Feed; let mut namespaces = HashMap::new(); namespaces.insert("ext".to_string(), "http://example.com".to_string()); let mut feed = Feed::default(); feed.set_namespaces(namespaces); assert_eq!(feed.namespaces().get("ext").map(|s| s.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 feed.
Examples
use std::collections::HashMap; use atom_syndication::Feed; let mut feed = Feed::default(); feed.set_namespaces(HashMap::new());
Trait Implementations
impl Clone for Feed
[src]
impl Debug for Feed
[src]
impl Default for Feed
[src]
impl FromStr for Feed
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Error>
[src]
impl PartialEq<Feed> for Feed
[src]
impl StructuralPartialEq for Feed
[src]
impl ToString for Feed
[src]
Auto Trait Implementations
impl RefUnwindSafe for Feed
impl Send for Feed
impl Sync for Feed
impl Unpin for Feed
impl UnwindSafe for Feed
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,
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.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,