pub struct Attachment { /* private fields */ }
Expand description
A relevant resource for an Item
.
§Valid Attachment
An Attachment
must have both the url
and mime_type
properties set.
Implementations§
Source§impl Attachment
impl Attachment
Sourcepub fn as_map_mut(&mut self) -> &mut Map<String, Value>
pub fn as_map_mut(&mut self) -> &mut Map<String, Value>
Returns the inner Map
as a mutable reference.
Sourcepub fn into_inner(self) -> Map<String, Value>
pub fn into_inner(self) -> Map<String, Value>
Converts the type into the inner Map
.
Sourcepub fn remove_url(&mut self) -> Option<Value>
pub fn remove_url(&mut self) -> Option<Value>
Removes the URL.
Sourcepub fn mime_type(&self) -> Result<Option<&str>, Error>
pub fn mime_type(&self) -> Result<Option<&str>, Error>
The required MIME type (e.g. image/png).
Sourcepub fn set_mime_type<T>(&mut self, value: T) -> Option<Value>where
T: ToString,
pub fn set_mime_type<T>(&mut self, value: T) -> Option<Value>where
T: ToString,
Sets the MIME type.
Sourcepub fn remove_mime_type(&mut self) -> Option<Value>
pub fn remove_mime_type(&mut self) -> Option<Value>
Removes the MIME type.
Sourcepub fn title(&self) -> Result<Option<&str>, Error>
pub fn title(&self) -> Result<Option<&str>, Error>
An optional title for the attachment.
§Important
Attachments with the same title are considered to be alternative representations of an attachment.
Sourcepub fn remove_title(&mut self) -> Option<Value>
pub fn remove_title(&mut self) -> Option<Value>
Removes the title.
Sourcepub fn size_in_bytes(&self) -> Result<Option<u64>, Error>
pub fn size_in_bytes(&self) -> Result<Option<u64>, Error>
The optional size of the attachment in bytes.
Sourcepub fn set_size_in_bytes<T>(&mut self, value: u64) -> Option<Value>
pub fn set_size_in_bytes<T>(&mut self, value: u64) -> Option<Value>
Sets the size in bytes.
Sourcepub fn remove_size_in_bytes<T>(&mut self) -> Option<Value>where
T: ToString,
pub fn remove_size_in_bytes<T>(&mut self) -> Option<Value>where
T: ToString,
Removes the size in bytes.
Sourcepub fn duration_in_seconds(&self) -> Result<Option<u64>, Error>
pub fn duration_in_seconds(&self) -> Result<Option<u64>, Error>
The optional duration of the content in seconds.
Sourcepub fn set_duration_in_seconds<T>(&mut self, value: u64) -> Option<Value>
pub fn set_duration_in_seconds<T>(&mut self, value: u64) -> Option<Value>
Sets the duration of in seconds.
Sourcepub fn remove_duration_in_seconds<T>(&mut self) -> Option<Value>where
T: ToString,
pub fn remove_duration_in_seconds<T>(&mut self) -> Option<Value>where
T: ToString,
Removes the duration in seconds.
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Attachment
impl Debug for Attachment
Source§impl Default for Attachment
impl Default for Attachment
Source§impl<'de> Deserialize<'de> for Attachment
impl<'de> Deserialize<'de> for Attachment
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Attachment
impl PartialEq for Attachment
Source§impl Serialize for Attachment
impl Serialize for Attachment
impl Eq for Attachment
Auto Trait Implementations§
impl Freeze for Attachment
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnwindSafe for Attachment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more