[−][src]Struct json_feed_model::ItemRef
An Item
implemented with a borrowed reference to a JSON object.
Implementations
impl<'a> ItemRef<'a>
[src]
impl<'a> ItemRef<'a>
[src]
pub fn to_item(&self) -> Item
[src]
Clones the inner Map
reference and returns an owned type.
pub fn id(&self) -> Result<Option<&str>, Error>
[src]
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.
pub fn url(&self) -> Result<Option<&str>, Error>
[src]
The optional URL which the item represents.
pub fn external_url(&self) -> Result<Option<&str>, Error>
[src]
An optional related external URL to the item.
pub fn title(&self) -> Result<Option<&str>, Error>
[src]
An optional title for the item.
pub fn content_html(&self) -> Result<Option<&str>, Error>
[src]
An optional HTML string representing the content.
pub fn content_text(&self) -> Result<Option<&str>, Error>
[src]
An optional plain text string representing the content.
pub fn summary(&self) -> Result<Option<&str>, Error>
[src]
An optional summary of the item.
pub fn image(&self) -> Result<Option<&str>, Error>
[src]
An optional URL of an image representing the item.
pub fn banner_image(&self) -> Result<Option<&str>, Error>
[src]
An optional URL of a banner image representing the item.
pub fn date_published(&self) -> Result<Option<&str>, Error>
[src]
The date which the item was published in RFC 3339 format.
pub fn date_modified(&self) -> Result<Option<&str>, Error>
[src]
The date which the item was modified in RFC 3339 format.
pub fn author(&self) -> Result<Option<AuthorRef<'_>>, Error>
[src]
An optional author.
Deprecation
The author
field is deprecated in favor of the authors
field as of JSON Feed 1.1.
pub fn authors(&self) -> Result<Option<Vec<AuthorRef<'_>>>, Error>
[src]
An optional array of authors.
pub fn tags(&self) -> Result<Option<Vec<&str>>, Error>
[src]
An optional array of plain text tags.
pub fn language(&self) -> Result<Option<&str>, Error>
[src]
The optional language which the feed data is written in.
Valid values are from RFC 5646.
pub fn attachments(&self) -> Result<Option<Vec<AttachmentRef<'_>>>, Error>
[src]
An optional array of relevant resources for the item.
impl<'a> ItemRef<'a>
[src]
pub fn is_valid(&self, version: &Version<'_>) -> bool
[src]
Verifies if the JSON data complies with a specific Version
of the JSON Feed spec.
Trait Implementations
impl<'a> AsRef<Map<String, Value>> for ItemRef<'a>
[src]
impl<'a> Debug for ItemRef<'a>
[src]
impl<'a> Eq for ItemRef<'a>
[src]
impl<'a> From<&'a Map<String, Value>> for ItemRef<'a>
[src]
impl<'a> From<&'a mut Map<String, Value>> for ItemRef<'a>
[src]
impl<'a> PartialEq<ItemRef<'a>> for ItemRef<'a>
[src]
fn eq(&self, other: &ItemRef<'_>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<Map<String, Value>> for ItemRef<'a>
[src]
fn eq(&self, other: &Map<String, Value>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> Serialize for ItemRef<'a>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,