Struct ruma_common::events::room::message::RoomMessageEventContent
source · [−]#[non_exhaustive]pub struct RoomMessageEventContent {
pub msgtype: MessageType,
pub relates_to: Option<Relation>,
}
Expand description
The content of an m.room.message
event.
This event is used when sending messages in a room.
Messages are not limited to be text.
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.msgtype: MessageType
A key which identifies the type of message being sent.
This also holds the specific content of each message.
relates_to: Option<Relation>
Information about related messages for rich replies.
Implementations
sourceimpl RoomMessageEventContent
impl RoomMessageEventContent
sourcepub fn new(msgtype: MessageType) -> Self
pub fn new(msgtype: MessageType) -> Self
Create a RoomMessageEventContent
with the given MessageType
.
sourcepub fn text_plain(body: impl Into<String>) -> Self
pub fn text_plain(body: impl Into<String>) -> Self
A constructor to create a plain text message.
sourcepub fn text_html(body: impl Into<String>, html_body: impl Into<String>) -> Self
pub fn text_html(body: impl Into<String>, html_body: impl Into<String>) -> Self
A constructor to create an html message.
sourcepub fn notice_plain(body: impl Into<String>) -> Self
pub fn notice_plain(body: impl Into<String>) -> Self
A constructor to create a plain text notice.
sourcepub fn notice_html(
body: impl Into<String>,
html_body: impl Into<String>
) -> Self
pub fn notice_html(
body: impl Into<String>,
html_body: impl Into<String>
) -> Self
A constructor to create an html notice.
sourcepub fn text_reply_plain(
reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
pub fn text_reply_plain(
reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
Creates a plain text reply to a message.
This constructor requires an OriginalRoomMessageEvent
since it creates a permalink to
the previous message, for which the room ID is required. If you want to reply to an
OriginalSyncRoomMessageEvent
, you have to convert it first by calling
.into_full_event()
.
sourcepub fn text_reply_html(
reply: impl Display,
html_reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
pub fn text_reply_html(
reply: impl Display,
html_reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
Creates a html text reply to a message.
This constructor requires an OriginalRoomMessageEvent
since it creates a permalink to
the previous message, for which the room ID is required. If you want to reply to an
OriginalSyncRoomMessageEvent
, you have to convert it first by calling
.into_full_event()
.
sourcepub fn notice_reply_plain(
reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
pub fn notice_reply_plain(
reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
Creates a plain text notice reply to a message.
This constructor requires an OriginalRoomMessageEvent
since it creates a permalink to
the previous message, for which the room ID is required. If you want to reply to an
OriginalSyncRoomMessageEvent
, you have to convert it first by calling
.into_full_event()
.
sourcepub fn notice_reply_html(
reply: impl Display,
html_reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
pub fn notice_reply_html(
reply: impl Display,
html_reply: impl Display,
original_message: &OriginalRoomMessageEvent
) -> Self
Creates a html text notice reply to a message.
This constructor requires an OriginalRoomMessageEvent
since it creates a permalink to
the previous message, for which the room ID is required. If you want to reply to an
OriginalSyncRoomMessageEvent
, you have to convert it first by calling
.into_full_event()
.
Trait Implementations
sourceimpl Clone for RoomMessageEventContent
impl Clone for RoomMessageEventContent
sourcefn clone(&self) -> RoomMessageEventContent
fn clone(&self) -> RoomMessageEventContent
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RoomMessageEventContent
impl Debug for RoomMessageEventContent
sourceimpl<'de> Deserialize<'de> for RoomMessageEventContent
impl<'de> Deserialize<'de> for RoomMessageEventContent
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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl EventContent for RoomMessageEventContent
impl EventContent for RoomMessageEventContent
type EventType = MessageLikeEventType
type EventType = MessageLikeEventType
The Rust enum for the event kind’s known types.
sourcefn event_type(&self) -> Self::EventType
fn event_type(&self) -> Self::EventType
Get the event’s type, like m.room.message
.
sourceimpl From<MessageType> for RoomMessageEventContent
impl From<MessageType> for RoomMessageEventContent
sourcefn from(msgtype: MessageType) -> Self
fn from(msgtype: MessageType) -> Self
Converts to this type from the input type.
sourceimpl From<RoomMessageEventContent> for AnyMessageLikeEventContent
impl From<RoomMessageEventContent> for AnyMessageLikeEventContent
sourcefn from(c: RoomMessageEventContent) -> Self
fn from(c: RoomMessageEventContent) -> Self
Converts to this type from the input type.
sourceimpl RedactContent for RoomMessageEventContent
impl RedactContent for RoomMessageEventContent
type Redacted = RedactedRoomMessageEventContent
type Redacted = RedactedRoomMessageEventContent
The redacted form of the event’s content.
sourcefn redact(self, version: &RoomVersionId) -> RedactedRoomMessageEventContent
fn redact(self, version: &RoomVersionId) -> RedactedRoomMessageEventContent
Transform self
into a redacted form (removing most or all fields) according to the spec. Read more
sourceimpl Serialize for RoomMessageEventContent
impl Serialize for RoomMessageEventContent
Auto Trait Implementations
impl RefUnwindSafe for RoomMessageEventContent
impl Send for RoomMessageEventContent
impl Sync for RoomMessageEventContent
impl Unpin for RoomMessageEventContent
impl UnwindSafe for RoomMessageEventContent
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more