Struct matrix_sdk_base::ruma::events::room::message::ImageMessageEventContent
#[non_exhaustive]pub struct ImageMessageEventContent {
pub body: String,
pub source: MediaSource,
pub info: Option<Box<ImageInfo>>,
}
Expand description
The payload for an image message.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.body: String
A textual representation of the image.
Could be the alt text of the image, the filename of the image, or some kind of content description for accessibility e.g. “image attachment”.
source: MediaSource
The source of the image.
info: Option<Box<ImageInfo>>
Metadata about the image referred to in source
.
Implementations§
§impl ImageMessageEventContent
impl ImageMessageEventContent
pub fn new(body: String, source: MediaSource) -> ImageMessageEventContent
pub fn new(body: String, source: MediaSource) -> ImageMessageEventContent
Creates a new ImageMessageEventContent
with the given body and source.
pub fn plain(body: String, url: OwnedMxcUri) -> ImageMessageEventContent
pub fn plain(body: String, url: OwnedMxcUri) -> ImageMessageEventContent
Creates a new non-encrypted ImageMessageEventContent
with the given body and url.
pub fn encrypted(body: String, file: EncryptedFile) -> ImageMessageEventContent
pub fn encrypted(body: String, file: EncryptedFile) -> ImageMessageEventContent
Creates a new encrypted ImageMessageEventContent
with the given body and encrypted
file.
pub fn info(
self,
info: impl Into<Option<Box<ImageInfo>>>
) -> ImageMessageEventContent
pub fn info( self, info: impl Into<Option<Box<ImageInfo>>> ) -> ImageMessageEventContent
Creates a new ImageMessageEventContent
from self
with the info
field set to the given
value.
Since the field is public, you can also assign to it directly. This method merely acts as a shorthand for that, because it is very common to set this field.
Trait Implementations§
§impl Clone for ImageMessageEventContent
impl Clone for ImageMessageEventContent
§fn clone(&self) -> ImageMessageEventContent
fn clone(&self) -> ImageMessageEventContent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ImageMessageEventContent
impl Debug for ImageMessageEventContent
§impl<'de> Deserialize<'de> for ImageMessageEventContent
impl<'de> Deserialize<'de> for ImageMessageEventContent
§fn deserialize<__D>(
__deserializer: __D
) -> Result<ImageMessageEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ImageMessageEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl MediaEventContent for ImageMessageEventContent
impl MediaEventContent for ImageMessageEventContent
source§fn thumbnail_source(&self) -> Option<MediaSource>
fn thumbnail_source(&self) -> Option<MediaSource>
Self
. Read more