[−][src]Struct json_feed_model::ItemMut
An Item
implemented with a borrowed mutable reference to a JSON object.
Implementations
impl<'a> ItemMut<'a>
[src]
impl<'a> ItemMut<'a>
[src]
pub fn as_map_mut(&mut self) -> &mut Map<String, Value>
[src]
Returns the inner Map
as a mutable reference.
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 set_id<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the ID.
pub fn remove_id(&mut self) -> Option<Value>
[src]
Removes the ID.
pub fn url(&self) -> Result<Option<&str>, Error>
[src]
The optional URL which the item represents.
pub fn set_url<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the URL.
pub fn remove_url(&mut self) -> Option<Value>
[src]
Removes the URL.
pub fn external_url(&self) -> Result<Option<&str>, Error>
[src]
An optional related external URL to the item.
pub fn set_external_url<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the external URL.
pub fn remove_external_url(&mut self) -> Option<Value>
[src]
Removes the external URL.
pub fn title(&self) -> Result<Option<&str>, Error>
[src]
An optional title for the item.
pub fn set_title<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the title.
pub fn remove_title(&mut self) -> Option<Value>
[src]
Removes the title.
pub fn content_html(&self) -> Result<Option<&str>, Error>
[src]
An optional HTML string representing the content.
pub fn set_content_html<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the HTML content.
pub fn remove_content_html(&mut self) -> Option<Value>
[src]
Removes the HTML content.
pub fn content_text(&self) -> Result<Option<&str>, Error>
[src]
An optional plain text string representing the content.
pub fn set_content_text<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the plain text content.
pub fn remove_content_text(&mut self) -> Option<Value>
[src]
Removes the plain text content.
pub fn summary(&self) -> Result<Option<&str>, Error>
[src]
An optional summary of the item.
pub fn set_summary<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the summary.
pub fn remove_summary(&mut self) -> Option<Value>
[src]
Removes the summary.
pub fn image(&self) -> Result<Option<&str>, Error>
[src]
An optional URL of an image representing the item.
pub fn set_image<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the image.
pub fn remove_image(&mut self) -> Option<Value>
[src]
Removes the image.
pub fn banner_image(&self) -> Result<Option<&str>, Error>
[src]
An optional URL of a banner image representing the item.
pub fn set_banner_image<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the banner image.
pub fn remove_banner_image(&mut self) -> Option<Value>
[src]
Removes the banner image.
pub fn date_published(&self) -> Result<Option<&str>, Error>
[src]
The date which the item was published in RFC 3339 format.
pub fn set_date_published<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the date published.
pub fn remove_date_published(&mut self) -> Option<Value>
[src]
Removes the date published.
pub fn date_modified(&self) -> Result<Option<&str>, Error>
[src]
The date which the item was modified in RFC 3339 format.
pub fn set_date_modified<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the date modified.
pub fn remove_date_modified(&mut self) -> Option<Value>
[src]
Removes the date modified.
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 author_mut(&mut self) -> Result<Option<AuthorMut<'_>>, 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 set_author(&mut self, value: Author) -> Option<Value>
[src]
Sets the author.
pub fn remove_author(&mut self) -> Option<Value>
[src]
Removes the author.
pub fn authors(&self) -> Result<Option<Vec<AuthorRef<'_>>>, Error>
[src]
An optional array of authors.
pub fn authors_mut(&mut self) -> Result<Option<Vec<AuthorMut<'_>>>, Error>
[src]
An optional array of authors.
pub fn set_authors<I>(&mut self, items: I) -> Option<Value> where
I: IntoIterator<Item = Author>,
[src]
I: IntoIterator<Item = Author>,
Sets the authors.
pub fn remove_authors(&mut self) -> Option<Value>
[src]
Removes the authors.
pub fn tags(&self) -> Result<Option<Vec<&str>>, Error>
[src]
An optional array of plain text tags.
pub fn set_tags<I>(&mut self, values: I) -> Option<Value> where
I: IntoIterator<Item = String>,
[src]
I: IntoIterator<Item = String>,
Sets the tags.
pub fn remove_tags(&mut self) -> Option<Value>
[src]
Removes the 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 set_language<T>(&mut self, value: T) -> Option<Value> where
T: ToString,
[src]
T: ToString,
Sets the language.
pub fn remove_language(&mut self) -> Option<Value>
[src]
Removes the language.
pub fn attachments(&self) -> Result<Option<Vec<AttachmentRef<'_>>>, Error>
[src]
An optional array of relevant resources for the item.
pub fn attachments_mut(
&mut self
) -> Result<Option<Vec<AttachmentMut<'_>>>, Error>
[src]
&mut self
) -> Result<Option<Vec<AttachmentMut<'_>>>, Error>
An optional array of relevant resources for the item.
pub fn set_attachments<I>(&mut self, items: I) -> Option<Value> where
I: IntoIterator<Item = Attachment>,
[src]
I: IntoIterator<Item = Attachment>,
Sets the attachments.
pub fn remove_attachments(&mut self) -> Option<Value>
[src]
Removes the attachments.
impl<'a> ItemMut<'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> AsMut<Map<String, Value>> for ItemMut<'a>
[src]
impl<'a> AsRef<Map<String, Value>> for ItemMut<'a>
[src]
impl<'a> Debug for ItemMut<'a>
[src]
impl<'a> Eq for ItemMut<'a>
[src]
impl<'a> From<&'a mut Map<String, Value>> for ItemMut<'a>
[src]
impl<'a> PartialEq<ItemMut<'a>> for ItemMut<'a>
[src]
fn eq(&self, other: &ItemMut<'_>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<Map<String, Value>> for ItemMut<'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 ItemMut<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for ItemMut<'a>
impl<'a> Send for ItemMut<'a>
impl<'a> Sync for ItemMut<'a>
impl<'a> Unpin for ItemMut<'a>
impl<'a> !UnwindSafe for ItemMut<'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>,