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>>,
}
events
and unstable-msc3552
only.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
unstable-msc3955
only.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) -> ImageEventContent
pub fn new(text: TextContentBlock, file: FileContentBlock) -> ImageEventContent
Creates a new ImageEventContent
with the given fallback representation and
file.
sourcepub fn with_plain_text(
plain_text: impl Into<String>,
file: FileContentBlock,
) -> ImageEventContent
pub fn with_plain_text( plain_text: impl Into<String>, file: FileContentBlock, ) -> ImageEventContent
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<ImageEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ImageEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl EventContent for ImageEventContent
impl EventContent for ImageEventContent
source§type EventType = MessageLikeEventType
type EventType = MessageLikeEventType
source§fn event_type(&self) -> <ImageEventContent as EventContent>::EventType
fn event_type(&self) -> <ImageEventContent as EventContent>::EventType
m.room.message
.source§impl From<ImageEventContent> for AnyMessageLikeEventContent
impl From<ImageEventContent> for AnyMessageLikeEventContent
source§fn from(c: ImageEventContent) -> AnyMessageLikeEventContent
fn from(c: ImageEventContent) -> AnyMessageLikeEventContent
source§impl From<ImageEventContent> for ImageEventContentWithoutRelation
impl From<ImageEventContent> for ImageEventContentWithoutRelation
source§fn from(c: ImageEventContent) -> ImageEventContentWithoutRelation
fn from(c: ImageEventContent) -> ImageEventContentWithoutRelation
source§impl RedactContent for ImageEventContent
impl RedactContent for ImageEventContent
source§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 moresource§impl Serialize for ImageEventContent
impl Serialize for ImageEventContent
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl MessageLikeEventContent for ImageEventContent
Auto Trait Implementations§
impl Freeze for ImageEventContent
impl RefUnwindSafe for ImageEventContent
impl Send for ImageEventContent
impl Sync for ImageEventContent
impl Unpin for ImageEventContent
impl UnwindSafe for ImageEventContent
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> EventContentFromType for Twhere
T: EventContent + DeserializeOwned,
impl<T> EventContentFromType for Twhere
T: EventContent + DeserializeOwned,
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