feed_rs::model

Struct Feed

source
pub struct Feed {
Show 18 fields pub feed_type: FeedType, pub id: String, pub title: Option<Text>, pub updated: Option<DateTime<Utc>>, pub authors: Vec<Person>, pub description: Option<Text>, pub links: Vec<Link>, pub categories: Vec<Category>, pub contributors: Vec<Person>, pub generator: Option<Generator>, pub icon: Option<Image>, pub language: Option<String>, pub logo: Option<Image>, pub published: Option<DateTime<Utc>>, pub rating: Option<MediaRating>, pub rights: Option<Text>, pub ttl: Option<u32>, pub entries: Vec<Entry>,
}
Expand description

Combined model for a syndication feed (i.e. RSS1, RSS 2, Atom, JSON Feed)

The model is based on the Atom standard as a start with RSS1+2 mapped on to it e.g.

  • Atom
    • Feed -> Feed
    • Entry -> Entry
  • RSS 1 + 2
    • Channel -> Feed
    • Item -> Entry

Certain elements are not mapped given their limited utility:

  • RSS 2:
    • channel - docs (pointer to the spec), cloud (for callbacks), textInput (text box e.g. for search)
    • item - comments (link to comments on the article), source (pointer to the channel, but our data model links items to a channel)
  • RSS 1:
    • channel - rdf:about attribute (pointer to feed), textinput (text box e.g. for search)

Fields§

§feed_type: FeedType

Type of this feed (e.g. RSS2, Atom etc)

§id: String

A unique identifier for this feed

  • Atom (required): Identifies the feed using a universally unique and permanent URI.
  • RSS doesn’t require an ID so it is initialised to the hash of the first link or a UUID if not found
§title: Option<Text>

The title of the feed

  • Atom (required): Contains a human readable title for the feed. Often the same as the title of the associated website. This value should not be blank.
  • RSS 1 + 2 (required) “title”: The name of the channel. It’s how people refer to your service.
  • JSON Feed: is the name of the feed
§updated: Option<DateTime<Utc>>

The time at which the feed was last modified. If not provided in the source, or invalid, it is None.

  • Atom (required): Indicates the last time the feed was modified in a significant way.
  • RSS 2 (optional) “lastBuildDate”: The last time the content of the channel changed.
§authors: Vec<Person>

Atom (recommended): Collection of authors defined at the feed level. JSON Feed: specifies the feed author.

§description: Option<Text>

Description of the feed

  • Atom (optional): Contains a human-readable description or subtitle for the feed (from ).
  • RSS 1 + 2 (required): Phrase or sentence describing the channel.
  • JSON Feed: description of the feed
§links: Vec<Link>

Links to related pages

  • Atom (recommended): Identifies a related Web page.
  • RSS 1 + 2 (required): The URL to the HTML website corresponding to the channel.
  • JSON Feed: the homepage and feed URLs
§categories: Vec<Category>

Structured classification of the feed

  • Atom (optional): Specifies a category that the feed belongs to. A feed may have multiple category elements.
  • RSS 2 (optional) “category”: Specify one or more categories that the channel belongs to.
§contributors: Vec<Person>

People who have contributed to the feed

  • Atom (optional): Names one contributor to the feed. A feed may have multiple contributor elements.
  • RSS 2 (optional) “managingEditor”: Email address for person responsible for editorial content.
  • RSS 2 (optional) “webMaster”: Email address for person responsible for technical issues relating to channel.
§generator: Option<Generator>

Information on the software used to build the feed

  • Atom (optional): Identifies the software used to generate the feed, for debugging and other purposes.
  • RSS 2 (optional): A string indicating the program used to generate the channel.
§icon: Option<Image>

A small icon

  • Atom (optional): Identifies a small image which provides iconic visual identification for the feed.
  • JSON Feed: is the URL of an image for the feed suitable to be used in a source list.
§language: Option<String>

RSS 2 (optional): The language the channel is written in.

An image used to visually identify the feed

  • Atom (optional): Identifies a larger image which provides visual identification for the feed.
  • RSS 1 + 2 (optional) “image”: Specifies a GIF, JPEG or PNG image that can be displayed with the channel.
  • JSON Feed: is the URL of an image for the feed suitable to be used in a timeline
§published: Option<DateTime<Utc>>

RSS 2 (optional): The publication date for the content in the channel.

§rating: Option<MediaRating>

Rating for the content

  • Populated from the media or itunes namespaces
§rights: Option<Text>

Rights restricting content within the feed

  • Atom (optional): Conveys information about rights, e.g. copyrights, held in and over the feed.
  • RSS 2 (optional) “copyright”: Copyright notice for content in the channel.
§ttl: Option<u32>

RSS 2 (optional): It’s a number of minutes that indicates how long a channel can be cached before refreshing from the source.

§entries: Vec<Entry>

The individual items within the feed

  • Atom (optional): Individual entries within the feed (e.g. a blog post)
  • RSS 1+2 (optional): Individual items within the channel.

Trait Implementations§

source§

impl Clone for Feed

source§

fn clone(&self) -> Feed

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 Feed

source§

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

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

impl PartialEq for Feed

source§

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

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

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

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

impl StructuralPartialEq for Feed

Auto Trait Implementations§

§

impl Freeze for Feed

§

impl RefUnwindSafe for Feed

§

impl Send for Feed

§

impl Sync for Feed

§

impl Unpin for Feed

§

impl UnwindSafe for Feed

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.