pub struct Attachment { /* private fields */ }Expand description
A typed media attachment supplied with a user message.
Keeping the MIME type beside the URL lets each provider choose the correct protocol content block without guessing from a provider-generated URL.
Implementations§
Source§impl Attachment
impl Attachment
Sourcepub const fn new(url: Url, media_type: Mime) -> Self
pub const fn new(url: Url, media_type: Mime) -> Self
Creates an attachment with an explicit MIME type.
Sourcepub const fn media_type(&self) -> &Mime
pub const fn media_type(&self) -> &Mime
Returns the declared MIME type.
Sourcepub fn with_url(self, url: Url) -> Self
pub fn with_url(self, url: Url) -> Self
Replaces the URL while preserving the declared MIME type.
Sourcepub fn into_parts(self) -> (Url, Mime)
pub fn into_parts(self) -> (Url, Mime)
Splits the attachment into its URL and MIME type.
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<'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
impl Eq for Attachment
Source§impl PartialEq for Attachment
impl PartialEq for Attachment
Source§impl Serialize for Attachment
impl Serialize for Attachment
impl StructuralPartialEq 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 UnsafeUnpin 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