Struct ruma_events::image::ImageEventContent
source · pub struct ImageEventContent {
pub text: TextContentBlock,
pub file: FileContentBlock,
pub image_details: Option<ImageDetailsContentBlock>,
pub thumbnail: ThumbnailContentBlock,
pub caption: Option<CaptionContentBlock>,
pub alt_text: Option<AltTextContentBlock>,
pub automated: bool,
pub relates_to: Option<Relation<ImageEventContentWithoutRelation>>,
}
Expand description
The payload for an extensible image message.
This is the new primary type introduced in MSC3552 and should only be sent in rooms with a
version that supports it. This type replaces both the m.room.message
type with msgtype: "m.image"
and the m.sticker
type. To replace the latter, sticker
must be set to true
in
image_details
. See the documentation of the message
module for more information.
Fields§
§text: TextContentBlock
The text representation of the message.
file: FileContentBlock
The file content of the message.
image_details: Option<ImageDetailsContentBlock>
The image details of the message, if any.
thumbnail: ThumbnailContentBlock
The thumbnails of the message, if any.
This is optional and defaults to an empty array.
caption: Option<CaptionContentBlock>
The caption of the message, if any.
alt_text: Option<AltTextContentBlock>
The alternative text of the image, for accessibility considerations, if any.
automated: bool
Whether this message is automated.
relates_to: Option<Relation<ImageEventContentWithoutRelation>>
Information about related messages.
Implementations§
source§impl ImageEventContent
impl ImageEventContent
sourcepub fn new(text: TextContentBlock, file: FileContentBlock) -> Self
pub fn new(text: TextContentBlock, file: FileContentBlock) -> Self
Creates a new ImageEventContent
with the given fallback representation and
file.
sourcepub fn with_plain_text(
plain_text: impl Into<String>,
file: FileContentBlock
) -> Self
pub fn with_plain_text( plain_text: impl Into<String>, file: FileContentBlock ) -> Self
Creates a new ImageEventContent
with the given plain text fallback representation and
file.
Trait Implementations§
source§impl Clone for ImageEventContent
impl Clone for ImageEventContent
source§fn clone(&self) -> ImageEventContent
fn clone(&self) -> ImageEventContent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ImageEventContent
impl Debug for ImageEventContent
source§impl<'de> Deserialize<'de> for ImageEventContent
impl<'de> Deserialize<'de> for ImageEventContent
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>,
source§impl EventContent for ImageEventContent
impl EventContent for ImageEventContent
§type EventType = MessageLikeEventType
type EventType = MessageLikeEventType
source§fn event_type(&self) -> Self::EventType
fn event_type(&self) -> Self::EventType
m.room.message
.source§impl From<ImageEventContent> for AnyMessageLikeEventContent
impl From<ImageEventContent> for AnyMessageLikeEventContent
source§fn from(c: ImageEventContent) -> Self
fn from(c: ImageEventContent) -> Self
source§impl From<ImageEventContent> for ImageEventContentWithoutRelation
impl From<ImageEventContent> for ImageEventContentWithoutRelation
source§fn from(c: ImageEventContent) -> Self
fn from(c: ImageEventContent) -> Self
source§impl RedactContent for ImageEventContent
impl RedactContent for ImageEventContent
§type Redacted = RedactedImageEventContent
type Redacted = RedactedImageEventContent
source§fn redact(self, version: &RoomVersionId) -> RedactedImageEventContent
fn redact(self, version: &RoomVersionId) -> RedactedImageEventContent
self
into a redacted form (removing most or all fields) according to the spec. Read more