[−][src]Struct json_feed_model::Attachment
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]
T: ToString,
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]
T: ToString,
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]
T: ToString,
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]
T: ToString,
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]
T: ToString,
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]
fn clone(&self) -> Attachment
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Attachment
[src]
impl Default for Attachment
[src]
impl<'de> Deserialize<'de> for Attachment
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
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]
fn eq(&self, other: &Map<String, Value>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Attachment
[src]
Auto Trait Implementations
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnwindSafe for Attachment
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,