Struct ruma_common::events::emote::EmoteEventContent
source · [−]pub struct EmoteEventContent {
pub message: MessageContent,
pub relates_to: Option<Relation>,
}
events
and unstable-msc1767
only.Expand description
The payload for an extensible emote message.
This is the new primary type introduced in MSC1767 and should not be sent before the end of
the transition period. See the documentation of the message
module for more information.
EmoteEventContent
can be converted to a RoomMessageEventContent
with a
MessageType::Emote
. You can convert it back with
EmoteEventContent::from_emote_room_message()
.
Fields
message: MessageContent
The message’s text content.
relates_to: Option<Relation>
Information about related messages.
Implementations
sourceimpl EmoteEventContent
impl EmoteEventContent
sourcepub fn plain(body: impl Into<String>) -> Self
pub fn plain(body: impl Into<String>) -> Self
A convenience constructor to create a plain text emote.
sourcepub fn html(body: impl Into<String>, html_body: impl Into<String>) -> Self
pub fn html(body: impl Into<String>, html_body: impl Into<String>) -> Self
A convenience constructor to create an HTML emote.
sourcepub fn markdown(body: impl AsRef<str> + Into<String>) -> Self
Available on crate feature markdown
only.
pub fn markdown(body: impl AsRef<str> + Into<String>) -> Self
markdown
only.A convenience constructor to create a Markdown emote.
Returns an HTML emote if some Markdown formatting was detected, otherwise returns a plain text emote.
sourcepub fn from_emote_room_message(
content: EmoteMessageEventContent,
relates_to: Option<Relation>
) -> Self
pub fn from_emote_room_message(
content: EmoteMessageEventContent,
relates_to: Option<Relation>
) -> Self
Create a new EmoteEventContent
from the given EmoteMessageEventContent
and optional
relation.
Trait Implementations
sourceimpl Clone for EmoteEventContent
impl Clone for EmoteEventContent
sourcefn clone(&self) -> EmoteEventContent
fn clone(&self) -> EmoteEventContent
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for EmoteEventContent
impl Debug for EmoteEventContent
sourceimpl<'de> Deserialize<'de> for EmoteEventContent
impl<'de> Deserialize<'de> for EmoteEventContent
sourcefn 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>,
sourceimpl EventContent for EmoteEventContent
impl EventContent for EmoteEventContent
type EventType = MessageLikeEventType
type EventType = MessageLikeEventType
sourcefn event_type(&self) -> Self::EventType
fn event_type(&self) -> Self::EventType
m.room.message
.sourceimpl From<EmoteEventContent> for AnyMessageLikeEventContent
impl From<EmoteEventContent> for AnyMessageLikeEventContent
sourcefn from(c: EmoteEventContent) -> Self
fn from(c: EmoteEventContent) -> Self
sourceimpl From<EmoteEventContent> for RoomMessageEventContent
impl From<EmoteEventContent> for RoomMessageEventContent
sourcefn from(content: EmoteEventContent) -> Self
fn from(content: EmoteEventContent) -> Self
sourceimpl RedactContent for EmoteEventContent
impl RedactContent for EmoteEventContent
type Redacted = RedactedEmoteEventContent
type Redacted = RedactedEmoteEventContent
sourcefn redact(self, version: &RoomVersionId) -> RedactedEmoteEventContent
fn redact(self, version: &RoomVersionId) -> RedactedEmoteEventContent
self
into a redacted form (removing most or all fields) according to the spec. Read more