pub enum MediaPart<'a> {
Image(&'a ImageContent),
Audio(&'a AudioContent),
Video(&'a VideoContent),
File(&'a FileContent),
}Expand description
One media attachment of a Message, exposed by Message::media_parts.
This is the provider-neutral unified view (B7, v0.22.4) over the parallel
images / audio / videos / files vectors: provider request builders
iterate Message::media_parts once instead of each growing their own
modality-specific special cases.
Variants§
Image(&'a ImageContent)
An image attachment.
Audio(&'a AudioContent)
An audio attachment.
Video(&'a VideoContent)
A video attachment.
File(&'a FileContent)
A file/document attachment.
Implementations§
Source§impl<'a> MediaPart<'a>
impl<'a> MediaPart<'a>
Sourcepub fn mime_type(&self) -> Option<&str>
pub fn mime_type(&self) -> Option<&str>
Returns the explicit MIME type if the attachment carries one.
FileContent can store an out-of-band MIME type; for data URIs the
type embedded in the data: prefix is parsed instead.
Sourcepub fn base64_data(&self) -> Option<&str>
pub fn base64_data(&self) -> Option<&str>
Returns the raw base64 payload if the value is a base64 data URI.
Sourcepub fn is_data_uri(&self) -> bool
pub fn is_data_uri(&self) -> bool
Returns whether the value is a data: URI.
Trait Implementations§
impl<'a> StructuralPartialEq for MediaPart<'a>
Auto Trait Implementations§
impl<'a> Freeze for MediaPart<'a>
impl<'a> RefUnwindSafe for MediaPart<'a>
impl<'a> Send for MediaPart<'a>
impl<'a> Sync for MediaPart<'a>
impl<'a> Unpin for MediaPart<'a>
impl<'a> UnsafeUnpin for MediaPart<'a>
impl<'a> UnwindSafe for MediaPart<'a>
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