pub struct Source {
pub title: Text,
pub id: String,
pub updated: FixedDateTime,
pub authors: Vec<Person>,
pub categories: Vec<Category>,
pub contributors: Vec<Person>,
pub generator: Option<Generator>,
pub icon: Option<String>,
pub links: Vec<Link>,
pub logo: Option<String>,
pub rights: Option<Text>,
pub subtitle: Option<Text>,
}
Expand description
Represents the source of an Atom entry
Fields§
§title: Text
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<Text>
Information about rights held in and over the feed.
subtitle: Option<Text>
A human-readable description or subtitle for the feed.
Implementations§
Source§impl Source
impl Source
Sourcepub fn title(&self) -> &Text
pub fn title(&self) -> &Text
Return the title of the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_title("Feed Title");
assert_eq!(source.title(), "Feed Title");
Sourcepub fn set_title<V>(&mut self, title: V)
pub fn set_title<V>(&mut self, title: V)
Set the title of the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_title("Feed Title");
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Return the unique URI of the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_id("urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
assert_eq!(source.id(), "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
Sourcepub fn set_id<V>(&mut self, id: V)
pub fn set_id<V>(&mut self, id: V)
Set the unique URI of the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_id("urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
Sourcepub fn updated(&self) -> &FixedDateTime
pub fn updated(&self) -> &FixedDateTime
Return the last time that the source feed was modified.
§Examples
use atom_syndication::Source;
use atom_syndication::FixedDateTime;
use std::str::FromStr;
let mut source = Source::default();
source.set_updated(FixedDateTime::from_str("2017-06-03T15:15:44-05:00").unwrap());
assert_eq!(source.updated().to_rfc3339(), "2017-06-03T15:15:44-05:00");
Sourcepub fn set_updated<V>(&mut self, updated: V)where
V: Into<FixedDateTime>,
pub fn set_updated<V>(&mut self, updated: V)where
V: Into<FixedDateTime>,
Set the last time that the source feed was modified.
§Examples
use atom_syndication::Source;
use atom_syndication::FixedDateTime;
use std::str::FromStr;
let mut source = Source::default();
source.set_updated(FixedDateTime::from_str("2017-06-03T15:15:44-05:00").unwrap());
Return the authors of the source feed.
§Examples
use atom_syndication::{Source, Person};
let mut source = Source::default();
source.set_authors(vec![Person::default()]);
assert_eq!(source.authors().len(), 1);
Set the authors of the source feed.
§Examples
use atom_syndication::{Source, Person};
let mut source = Source::default();
source.set_authors(vec![Person::default()]);
Sourcepub fn categories(&self) -> &[Category]
pub fn categories(&self) -> &[Category]
Return the categories the source feed belongs to.
§Examples
use atom_syndication::{Source, Category};
let mut source = Source::default();
source.set_categories(vec![Category::default()]);
assert_eq!(source.categories().len(), 1);
Sourcepub fn set_categories<V>(&mut self, categories: V)
pub fn set_categories<V>(&mut self, categories: V)
Set the categories the source feed belongs to.
§Examples
use atom_syndication::{Source, Category};
let mut source = Source::default();
source.set_categories(vec![Category::default()]);
Sourcepub fn contributors(&self) -> &[Person]
pub fn contributors(&self) -> &[Person]
Return the contributors to the source feed.
§Examples
use atom_syndication::{Source, Person};
let mut source = Source::default();
source.set_contributors(vec![Person::default()]);
assert_eq!(source.contributors().len(), 1);
Sourcepub fn set_contributors<V>(&mut self, contributors: V)
pub fn set_contributors<V>(&mut self, contributors: V)
Set the contributors to the source feed.
§Examples
use atom_syndication::{Source, Person};
let mut source = Source::default();
source.set_contributors(vec![Person::default()]);
Sourcepub fn generator(&self) -> Option<&Generator>
pub fn generator(&self) -> Option<&Generator>
Return the name of the software used to generate the source feed.
§Examples
use atom_syndication::{Source, Generator};
let mut source = Source::default();
source.set_generator(Generator::default());
assert!(source.generator().is_some());
Sourcepub fn set_generator<V>(&mut self, generator: V)
pub fn set_generator<V>(&mut self, generator: V)
Set the name of the software used to generate the source feed.
§Examples
use atom_syndication::{Source, Generator};
let mut source = Source::default();
source.set_generator(Generator::default());
Sourcepub fn icon(&self) -> Option<&str>
pub fn icon(&self) -> Option<&str>
Return the icon for the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_icon("http://example.com/icon.png".to_string());
assert_eq!(source.icon(), Some("http://example.com/icon.png"));
Sourcepub fn set_icon<V>(&mut self, icon: V)
pub fn set_icon<V>(&mut self, icon: V)
Set the icon for the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_icon("http://example.com/icon.png".to_string());
Sourcepub fn links(&self) -> &[Link]
pub fn links(&self) -> &[Link]
Return the Web pages related to the source feed.
§Examples
use atom_syndication::{Source, Link};
let mut source = Source::default();
source.set_links(vec![Link::default()]);
assert_eq!(source.links().len(), 1);
Sourcepub fn set_links<V>(&mut self, links: V)
pub fn set_links<V>(&mut self, links: V)
Set the Web pages related to the source feed.
§Examples
use atom_syndication::{Source, Link};
let mut source = Source::default();
source.set_links(vec![Link::default()]);
Sourcepub fn logo(&self) -> Option<&str>
pub fn logo(&self) -> Option<&str>
Return the logo for the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_logo("http://example.com/logo.png".to_string());
assert_eq!(source.logo(), Some("http://example.com/logo.png"));
Sourcepub fn set_logo<V>(&mut self, logo: V)
pub fn set_logo<V>(&mut self, logo: V)
Set the logo for the source feed.
§Examples
use atom_syndication::Source;
let mut source = Source::default();
source.set_logo("http://example.com/logo.png".to_string());
Sourcepub fn rights(&self) -> Option<&Text>
pub fn rights(&self) -> Option<&Text>
Return the information about the rights held in and over the source feed.
§Examples
use atom_syndication::{Source, Text};
let mut source = Source::default();
source.set_rights(Text::from("© 2017 John Doe"));
assert_eq!(source.rights().map(Text::as_str), Some("© 2017 John Doe"));
Sourcepub fn set_rights<V>(&mut self, rights: V)
pub fn set_rights<V>(&mut self, rights: V)
Set the information about the rights held in and over the source feed.
§Examples
use atom_syndication::{Source, Text};
let mut source = Source::default();
source.set_rights(Text::from("© 2017 John Doe"));
Sourcepub fn subtitle(&self) -> Option<&Text>
pub fn subtitle(&self) -> Option<&Text>
Return the description or subtitle of the source feed.
§Examples
use atom_syndication::{Source, Text};
let mut source = Source::default();
source.set_subtitle(Text::from("Feed subtitle"));
assert_eq!(source.subtitle().map(Text::as_str), Some("Feed subtitle"));