Struct ruma_events::room::message::ImageMessageEventContent
source · pub struct ImageMessageEventContent {
pub body: String,
pub formatted: Option<FormattedBody>,
pub filename: Option<String>,
pub source: MediaSource,
pub info: Option<Box<ImageInfo>>,
}
Expand description
The payload for an image message.
Fields§
§body: String
A textual representation of the image.
If the filename
field is not set or has the same value, this is the filename of the
uploaded file. Otherwise, this should be interpreted as a user-written media caption.
formatted: Option<FormattedBody>
Formatted form of the message body
.
This should only be set if the body represents a caption.
filename: Option<String>
The original filename of the uploaded file.
source: MediaSource
The source of the image.
info: Option<Box<ImageInfo>>
Metadata about the image referred to in source
.
Implementations§
source§impl ImageMessageEventContent
impl ImageMessageEventContent
sourcepub fn new(body: String, source: MediaSource) -> Self
pub fn new(body: String, source: MediaSource) -> Self
Creates a new ImageMessageEventContent
with the given body and source.
sourcepub fn plain(body: String, url: OwnedMxcUri) -> Self
pub fn plain(body: String, url: OwnedMxcUri) -> Self
Creates a new non-encrypted ImageMessageEventContent
with the given body and url.
sourcepub fn encrypted(body: String, file: EncryptedFile) -> Self
pub fn encrypted(body: String, file: EncryptedFile) -> Self
Creates a new encrypted ImageMessageEventContent
with the given body and encrypted
file.
sourcepub fn info(self, info: impl Into<Option<Box<ImageInfo>>>) -> Self
pub fn info(self, info: impl Into<Option<Box<ImageInfo>>>) -> Self
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§
source§impl Clone for ImageMessageEventContent
impl Clone for ImageMessageEventContent
source§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