pub(crate) enum VisualMediaMessage {
Image(ImageMessageEventContent),
Video(VideoMessageEventContent),
Sticker(Box<StickerEventContent>),
}
Expand description
A visual media message.
Variants§
Image(ImageMessageEventContent)
An image.
Video(VideoMessageEventContent)
A video.
Sticker(Box<StickerEventContent>)
A sticker.
Implementations§
Source§impl VisualMediaMessage
impl VisualMediaMessage
Sourcepub(crate) fn from_message(msgtype: &MessageType) -> Option<Self>
pub(crate) fn from_message(msgtype: &MessageType) -> Option<Self>
Construct a VisualMediaMessage
from the given message.
Sourcepub(crate) fn filename(&self) -> String
pub(crate) fn filename(&self) -> String
The filename of the media.
For a sticker, this returns the description of the sticker.
Sourcepub(crate) fn dimensions(&self) -> Option<FrameDimensions>
pub(crate) fn dimensions(&self) -> Option<FrameDimensions>
The dimensions of the media, if any.
Sourcepub(crate) fn visual_media_type(&self) -> VisualMediaType
pub(crate) fn visual_media_type(&self) -> VisualMediaType
The type of the media.
Sourcepub(crate) fn content_type(&self) -> ContentType
pub(crate) fn content_type(&self) -> ContentType
The content type of the media.
Sourcepub(crate) async fn thumbnail(
&self,
client: Client,
settings: ThumbnailSettings,
priority: ImageRequestPriority,
) -> Result<Option<Image>, ImageError>
pub(crate) async fn thumbnail( &self, client: Client, settings: ThumbnailSettings, priority: ImageRequestPriority, ) -> Result<Option<Image>, ImageError>
Fetch a thumbnail of the media with the given client and thumbnail settings.
This might not return a thumbnail at the requested size, depending on the message and the homeserver.
Returns Ok(None)
if no thumbnail could be retrieved and no fallback
could be downloaded. This only applies to video messages.
Returns an error if something occurred while fetching the content or loading it.
Sourcepub(crate) async fn into_tmp_file(
self,
client: &Client,
) -> Result<File, MediaFileError>
pub(crate) async fn into_tmp_file( self, client: &Client, ) -> Result<File, MediaFileError>
Fetch the content of the media with the given client and write it to a temporary file.
Returns an error if something occurred while fetching the content or saving the content to a file.
Sourcepub(crate) async fn save_to_file(
self,
client: &Client,
parent: &impl IsA<Widget>,
)
pub(crate) async fn save_to_file( self, client: &Client, parent: &impl IsA<Widget>, )
Save the content of the media to a file selected by the user.
Shows a dialog to the user to select a file on the system.
Trait Implementations§
Source§impl Clone for VisualMediaMessage
impl Clone for VisualMediaMessage
Source§fn clone(&self) -> VisualMediaMessage
fn clone(&self) -> VisualMediaMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for VisualMediaMessage
impl Debug for VisualMediaMessage
Source§impl From<Box<StickerEventContent>> for VisualMediaMessage
impl From<Box<StickerEventContent>> for VisualMediaMessage
Source§fn from(value: Box<StickerEventContent>) -> Self
fn from(value: Box<StickerEventContent>) -> Self
Source§impl From<ImageMessageEventContent> for VisualMediaMessage
impl From<ImageMessageEventContent> for VisualMediaMessage
Source§fn from(value: ImageMessageEventContent) -> Self
fn from(value: ImageMessageEventContent) -> Self
Source§impl From<StickerEventContent> for VisualMediaMessage
impl From<StickerEventContent> for VisualMediaMessage
Source§fn from(value: StickerEventContent) -> Self
fn from(value: StickerEventContent) -> Self
Source§impl From<VideoMessageEventContent> for VisualMediaMessage
impl From<VideoMessageEventContent> for VisualMediaMessage
Source§fn from(value: VideoMessageEventContent) -> Self
fn from(value: VideoMessageEventContent) -> Self
Source§impl From<VisualMediaMessage> for MediaMessage
impl From<VisualMediaMessage> for MediaMessage
Source§fn from(value: VisualMediaMessage) -> Self
fn from(value: VisualMediaMessage) -> Self
Auto Trait Implementations§
impl Freeze for VisualMediaMessage
impl RefUnwindSafe for VisualMediaMessage
impl Send for VisualMediaMessage
impl Sync for VisualMediaMessage
impl Unpin for VisualMediaMessage
impl UnwindSafe for VisualMediaMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more