Struct json_feed_model::ItemRef
source · [−]pub struct ItemRef<'a> { /* private fields */ }
Expand description
An Item
implemented with a borrowed reference to a JSON object.
Implementations
sourceimpl<'a> ItemRef<'a>
impl<'a> ItemRef<'a>
sourcepub fn id(&self) -> Result<Option<&str>, Error>
pub fn id(&self) -> Result<Option<&str>, Error>
A required unique identifier for an item.
Important
The ID should be unique across all items which have ever appeared in the feed.
An item with the same exact ID as another item (even if it is no longer in the
current JSON feed items
array) are considered the same item.
Version 1.0 Incompatibility
While JSON Feed 1.0 permitted values which could be coerced into JSON strings (e.g. JSON numbers), this model supports only JSON strings. JSON Feed 1.1 strongly suggests to only use strings. In practice, the vast majority of feeds use strings.
If you wish to support non-String IDs, you can directly access the underlying Map
with as_map_mut
or an equivalent method and
read the JSON value.
sourcepub fn external_url(&self) -> Result<Option<&str>, Error>
pub fn external_url(&self) -> Result<Option<&str>, Error>
An optional related external URL to the item.
sourcepub fn content_html(&self) -> Result<Option<&str>, Error>
pub fn content_html(&self) -> Result<Option<&str>, Error>
An optional HTML string representing the content.
sourcepub fn content_text(&self) -> Result<Option<&str>, Error>
pub fn content_text(&self) -> Result<Option<&str>, Error>
An optional plain text string representing the content.
sourcepub fn image(&self) -> Result<Option<&str>, Error>
pub fn image(&self) -> Result<Option<&str>, Error>
An optional URL of an image representing the item.
An optional URL of a banner image representing the item.
sourcepub fn date_published(&self) -> Result<Option<&str>, Error>
pub fn date_published(&self) -> Result<Option<&str>, Error>
The date which the item was published in RFC 3339 format.
sourcepub fn date_modified(&self) -> Result<Option<&str>, Error>
pub fn date_modified(&self) -> Result<Option<&str>, Error>
The date which the item was modified in RFC 3339 format.
An optional author.
Deprecation
The author
field is deprecated in favor of the authors
field as of JSON Feed 1.1.
An optional array of authors.
An optional array of plain text tags.
sourcepub fn language(&self) -> Result<Option<&str>, Error>
pub fn language(&self) -> Result<Option<&str>, Error>
The optional language which the feed data is written in.
Valid values are from RFC 5646.
sourcepub fn attachments(&self) -> Result<Option<Vec<AttachmentRef<'_>>>, Error>
pub fn attachments(&self) -> Result<Option<Vec<AttachmentRef<'_>>>, Error>
An optional array of relevant resources for the item.
Trait Implementations
impl<'a> Eq for ItemRef<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for ItemRef<'a>
impl<'a> Send for ItemRef<'a>
impl<'a> Sync for ItemRef<'a>
impl<'a> Unpin for ItemRef<'a>
impl<'a> UnwindSafe for ItemRef<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more