[][src]Struct json_feed_model::Attachment

pub struct Attachment { /* fields omitted */ }

A relevant resource for an Item.

Valid Attachment

An Attachment must have both the url and mime_type properties set.

Implementations

impl Attachment[src]

pub fn new() -> Self[src]

Instantiates with an empty JSON object.

pub fn as_map(&self) -> &Map<String, Value>[src]

Returns the inner Map as a reference.

pub fn as_map_mut(&mut self) -> &mut Map<String, Value>[src]

Returns the inner Map as a mutable reference.

pub fn into_inner(self) -> Map<String, Value>[src]

Converts the type into the inner Map.

pub fn url(&self) -> Result<Option<&str>, Error>[src]

The required URL for the attachment.

pub fn set_url<T>(&mut self, value: T) -> Option<Value> where
    T: ToString
[src]

Sets the URL.

pub fn remove_url(&mut self) -> Option<Value>[src]

Removes the URL.

pub fn mime_type(&self) -> Result<Option<&str>, Error>[src]

The required MIME type (e.g. image/png).

pub fn set_mime_type<T>(&mut self, value: T) -> Option<Value> where
    T: ToString
[src]

Sets the MIME type.

pub fn remove_mime_type(&mut self) -> Option<Value>[src]

Removes the MIME type.

pub fn title(&self) -> Result<Option<&str>, Error>[src]

An optional title for the attachment.

Important

Attachments with the same title are considered to be alternative representations of an attachment.

pub fn set_title<T>(&mut self, value: T) -> Option<Value> where
    T: ToString
[src]

Sets the title.

pub fn remove_title(&mut self) -> Option<Value>[src]

Removes the title.

pub fn size_in_bytes(&self) -> Result<Option<u64>, Error>[src]

The optional size of the attachment in bytes.

pub fn set_size_in_bytes<T>(&mut self, value: u64) -> Option<Value>[src]

Sets the size in bytes.

pub fn remove_size_in_bytes<T>(&mut self) -> Option<Value> where
    T: ToString
[src]

Removes the size in bytes.

pub fn duration_in_seconds(&self) -> Result<Option<u64>, Error>[src]

The optional duration of the content in seconds.

pub fn set_duration_in_seconds<T>(&mut self, value: u64) -> Option<Value>[src]

Sets the duration of in seconds.

pub fn remove_duration_in_seconds<T>(&mut self) -> Option<Value> where
    T: ToString
[src]

Removes the duration in seconds.

impl Attachment[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 AsMut<Map<String, Value>> for Attachment[src]

impl AsRef<Map<String, Value>> for Attachment[src]

impl Clone for Attachment[src]

impl Debug for Attachment[src]

impl Default for Attachment[src]

impl<'de> Deserialize<'de> for Attachment[src]

impl Eq for Attachment[src]

impl From<Map<String, Value>> for Attachment[src]

impl PartialEq<Attachment> for Attachment[src]

impl PartialEq<Map<String, Value>> for Attachment[src]

impl Serialize for Attachment[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.