Struct atom_syndication::Entry
source · pub struct Entry {Show 13 fields
pub title: Text,
pub id: String,
pub updated: FixedDateTime,
pub authors: Vec<Person>,
pub categories: Vec<Category>,
pub contributors: Vec<Person>,
pub links: Vec<Link>,
pub published: Option<FixedDateTime>,
pub rights: Option<Text>,
pub source: Option<Source>,
pub summary: Option<Text>,
pub content: Option<Content>,
pub extensions: ExtensionMap,
}
Expand description
Represents an entry in an Atom feed
Fields§
§title: Text
A human-readable title for the entry.
id: String
A universally unique and permanent URI.
updated: FixedDateTime
The last time the entry was modified.
The authors of the feed.
categories: Vec<Category>
The categories that the entry belongs to.
contributors: Vec<Person>
The contributors to the entry.
links: Vec<Link>
The Web pages related to the entry.
published: Option<FixedDateTime>
The time of the initial creation or first availability of the entry.
rights: Option<Text>
Information about rights held in and over the entry.
source: Option<Source>
The source information if an entry is copied from one feed into another feed.
summary: Option<Text>
A short summary, abstract, or excerpt of the entry.
content: Option<Content>
Contains or links to the complete content of the entry.
extensions: ExtensionMap
The extensions for this entry.
Implementations§
source§impl Entry
impl Entry
sourcepub fn title(&self) -> &Text
pub fn title(&self) -> &Text
Return the title of this entry.
Examples
use atom_syndication::Entry;
let mut entry = Entry::default();
entry.set_title("Entry Title");
assert_eq!(entry.title(), "Entry Title");
sourcepub fn set_title<V>(&mut self, title: V)where
V: Into<Text>,
pub fn set_title<V>(&mut self, title: V)where V: Into<Text>,
Set the title of this entry.
Examples
use atom_syndication::Entry;
let mut entry = Entry::default();
entry.set_title("Entry Title");
sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Return the unique URI of this entry.
Examples
use atom_syndication::Entry;
let mut entry = Entry::default();
entry.set_id("urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
assert_eq!(entry.id(), "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
sourcepub fn set_id<V>(&mut self, id: V)where
V: Into<String>,
pub fn set_id<V>(&mut self, id: V)where V: Into<String>,
Set the unique URI of this entry.
Examples
use atom_syndication::Entry;
let mut entry = Entry::default();
entry.set_id("urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6");
sourcepub fn updated(&self) -> &FixedDateTime
pub fn updated(&self) -> &FixedDateTime
Return the last time that this entry was modified.
Examples
use atom_syndication::Entry;
use atom_syndication::FixedDateTime;
use std::str::FromStr;
let mut entry = Entry::default();
entry.set_updated(FixedDateTime::from_str("2017-06-03T15:15:44-05:00").unwrap());
assert_eq!(entry.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 this entry was modified.
Examples
use atom_syndication::Entry;
use atom_syndication::FixedDateTime;
use std::str::FromStr;
let mut entry = Entry::default();
entry.set_updated(FixedDateTime::from_str("2017-06-03T15:15:44-05:00").unwrap());
Return the authors of this entry.
Examples
use atom_syndication::{Entry, Person};
let mut entry = Entry::default();
entry.set_authors(vec![Person::default()]);
assert_eq!(entry.authors().len(), 1);
Set the authors of this entry.
Examples
use atom_syndication::{Entry, Person};
let mut entry = Entry::default();
entry.set_authors(vec![Person::default()]);
sourcepub fn categories(&self) -> &[Category]
pub fn categories(&self) -> &[Category]
Return the categories this entry belongs to.
Examples
use atom_syndication::{Entry, Category};
let mut entry = Entry::default();
entry.set_categories(vec![Category::default()]);
assert_eq!(entry.categories().len(), 1);
sourcepub fn set_categories<V>(&mut self, categories: V)where
V: Into<Vec<Category>>,
pub fn set_categories<V>(&mut self, categories: V)where V: Into<Vec<Category>>,
Set the categories this entry belongs to.
Examples
use atom_syndication::{Entry, Category};
let mut entry = Entry::default();
entry.set_categories(vec![Category::default()]);
sourcepub fn contributors(&self) -> &[Person]
pub fn contributors(&self) -> &[Person]
Return the contributors to this entry.
Examples
use atom_syndication::{Entry, Person};
let mut entry = Entry::default();
entry.set_contributors(vec![Person::default()]);
assert_eq!(entry.contributors().len(), 1);
sourcepub fn set_contributors<V>(&mut self, contributors: V)where
V: Into<Vec<Person>>,
pub fn set_contributors<V>(&mut self, contributors: V)where V: Into<Vec<Person>>,
Set the contributors to this entry.
Examples
use atom_syndication::{Entry, Person};
let mut entry = Entry::default();
entry.set_contributors(vec![Person::default()]);
sourcepub fn links(&self) -> &[Link]
pub fn links(&self) -> &[Link]
Return the links for this entry.
Examples
use atom_syndication::{Entry, Link};
let mut entry = Entry::default();
entry.set_links(vec![Link::default()]);
assert_eq!(entry.links().len(), 1);
sourcepub fn set_links<V>(&mut self, links: V)where
V: Into<Vec<Link>>,
pub fn set_links<V>(&mut self, links: V)where V: Into<Vec<Link>>,
Set the links for this entry.
Examples
use atom_syndication::{Entry, Link};
let mut entry = Entry::default();
entry.set_links(vec![Link::default()]);
sourcepub fn published(&self) -> Option<&FixedDateTime>
pub fn published(&self) -> Option<&FixedDateTime>
Return the time that this entry was initially created or first made available.
Examples
use atom_syndication::Entry;
use atom_syndication::FixedDateTime;
use std::str::FromStr;
let mut entry = Entry::default();
entry.set_published(FixedDateTime::from_str("2017-06-01T15:15:44-05:00").unwrap());
assert_eq!(entry.published().map(|x|x.to_rfc3339()), Some("2017-06-01T15:15:44-05:00".to_string()));
sourcepub fn set_published<V>(&mut self, published: V)where
V: Into<Option<FixedDateTime>>,
pub fn set_published<V>(&mut self, published: V)where V: Into<Option<FixedDateTime>>,
Set the time that this entry was initially created or first made available.
Examples
use atom_syndication::Entry;
use atom_syndication::FixedDateTime;
use std::str::FromStr;
let mut entry = Entry::default();
entry.set_published(FixedDateTime::from_str("2017-06-01T15:15:44-05:00").unwrap());
sourcepub fn rights(&self) -> Option<&Text>
pub fn rights(&self) -> Option<&Text>
Return the information about the rights held in and over this entry.
Examples
use atom_syndication::{Entry, Text};
let mut entry = Entry::default();
entry.set_rights(Text::from("© 2017 John Doe"));
assert_eq!(entry.rights().map(Text::as_str), Some("© 2017 John Doe"));
sourcepub fn set_rights<V>(&mut self, rights: V)where
V: Into<Option<Text>>,
pub fn set_rights<V>(&mut self, rights: V)where V: Into<Option<Text>>,
Set the information about the rights held in and over this entry.
Examples
use atom_syndication::{Entry, Text};
let mut entry = Entry::default();
entry.set_rights(Text::from("© 2017 John Doe"));
sourcepub fn source(&self) -> Option<&Source>
pub fn source(&self) -> Option<&Source>
Return the source of this entry if it was copied from another feed.
Examples
use atom_syndication::{Entry, Source};
let mut entry = Entry::default();
entry.set_source(Source::default());
assert!(entry.source().is_some());
sourcepub fn set_source<V>(&mut self, source: V)where
V: Into<Option<Source>>,
pub fn set_source<V>(&mut self, source: V)where V: Into<Option<Source>>,
Set the source of this entry if it was copied from another feed.
Examples
use atom_syndication::{Entry, Source};
let mut entry = Entry::default();
entry.set_source(Source::default());
sourcepub fn summary(&self) -> Option<&Text>
pub fn summary(&self) -> Option<&Text>
Return the summary of this entry.
Examples
use atom_syndication::{Entry, Text};
let mut entry = Entry::default();
entry.set_summary(Text::from("Entry summary."));
assert_eq!(entry.summary().map(Text::as_str), Some("Entry summary."));
sourcepub fn set_summary<V>(&mut self, summary: V)where
V: Into<Option<Text>>,
pub fn set_summary<V>(&mut self, summary: V)where V: Into<Option<Text>>,
Set the summary of this entry.
Examples
use atom_syndication::{Entry, Text};
let mut entry = Entry::default();
entry.set_summary(Text::from("Entry summary."));
sourcepub fn content(&self) -> Option<&Content>
pub fn content(&self) -> Option<&Content>
Return the content of this entry.
Examples
use atom_syndication::{Entry, Content};
let mut entry = Entry::default();
entry.set_content(Content::default());
assert!(entry.content().is_some());
sourcepub fn set_content<V>(&mut self, content: V)where
V: Into<Option<Content>>,
pub fn set_content<V>(&mut self, content: V)where V: Into<Option<Content>>,
Set the content of this entry.
Examples
use atom_syndication::{Entry, Content};
let mut entry = Entry::default();
entry.set_content(Content::default());
assert!(entry.content().is_some());
sourcepub fn extensions(&self) -> &ExtensionMap
pub fn extensions(&self) -> &ExtensionMap
Return the extensions for this entry.
Examples
use std::collections::BTreeMap;
use atom_syndication::Entry;
use atom_syndication::extension::{ExtensionMap, Extension};
let extension = Extension::default();
let mut item_map = BTreeMap::<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 entry = Entry::default();
entry.set_extensions(extension_map);
assert_eq!(entry.extensions()
.get("ext")
.and_then(|m| m.get("ext:name"))
.map(|v| v.len()),
Some(1));
sourcepub fn set_extensions<V>(&mut self, extensions: V)where
V: Into<ExtensionMap>,
pub fn set_extensions<V>(&mut self, extensions: V)where V: Into<ExtensionMap>,
Set the extensions for this entry.
Examples
use atom_syndication::Entry;
use atom_syndication::extension::ExtensionMap;
let mut entry = Entry::default();
entry.set_extensions(ExtensionMap::default());