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.

§authors: Vec<Person>

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

source

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");
source

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");
source

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");
source

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");
source

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");
source

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());
source

pub fn authors(&self) -> &[Person]

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);
source

pub fn set_authors<V>(&mut self, authors: V)where V: Into<Vec<Person>>,

Set the authors of this entry.

Examples
use atom_syndication::{Entry, Person};

let mut entry = Entry::default();
entry.set_authors(vec![Person::default()]);
source

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);
source

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()]);
source

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);
source

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()]);

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);

Set the links for this entry.

Examples
use atom_syndication::{Entry, Link};

let mut entry = Entry::default();
entry.set_links(vec![Link::default()]);
source

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()));
source

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());
source

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"));
source

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"));
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());
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());
source

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."));
source

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."));
source

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());
source

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());
source

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));
source

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());

Trait Implementations§

source§

impl Clone for Entry

source§

fn clone(&self) -> Entry

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Entry

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Entry

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq<Entry> for Entry

source§

fn eq(&self, other: &Entry) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Entry

Auto Trait Implementations§

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.