Struct ruma_common::events::room::message::RoomMessageEventContent
source · [−]pub struct RoomMessageEventContent {
pub msgtype: MessageType,
pub relates_to: Option<Relation>,
}events only.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
msgtype: MessageTypeA 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 text_markdown(body: impl AsRef<str> + Into<String>) -> Self
Available on crate feature markdown only.
pub fn text_markdown(body: impl AsRef<str> + Into<String>) -> Self
markdown only.A constructor to create a markdown 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 notice_markdown(body: impl AsRef<str> + Into<String>) -> Self
Available on crate feature markdown only.
pub fn notice_markdown(body: impl AsRef<str> + Into<String>) -> Self
markdown only.A constructor to create a markdown 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().
sourcepub fn reply(
message: MessageType,
original_message: &OriginalRoomMessageEvent,
forward_thread: ForwardThread
) -> Self
Available on crate feature unstable-msc3440 only.
pub fn reply(
message: MessageType,
original_message: &OriginalRoomMessageEvent,
forward_thread: ForwardThread
) -> Self
unstable-msc3440 only.Create a new reply with the given message and optionally forwards the Relation::Thread.
If message is a text or notice message, it is modified to include the rich reply fallback.
sourcepub fn for_thread(
message: MessageType,
previous_message: &OriginalRoomMessageEvent,
is_reply: ReplyInThread
) -> Self
Available on crate feature unstable-msc3440 only.
pub fn for_thread(
message: MessageType,
previous_message: &OriginalRoomMessageEvent,
is_reply: ReplyInThread
) -> Self
unstable-msc3440 only.Create a new message for a thread that is optionally a reply.
Looks for a Relation::Thread in previous_message. If it exists, a message for the same
thread is created. If it doesn’t, a new thread with previous_message as the root is
created.
If message is a text or notice message, it is modified to include the rich reply fallback.
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
events only.The Rust enum for the event kind’s known types.
sourcefn event_type(&self) -> Self::EventType
fn event_type(&self) -> Self::EventType
events only.Get the event’s type, like m.room.message.
sourceimpl From<AudioEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc3246 only.
impl From<AudioEventContent> for RoomMessageEventContent
unstable-msc3246 only.sourcefn from(content: AudioEventContent) -> Self
fn from(content: AudioEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<EmoteEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc1767 only.
impl From<EmoteEventContent> for RoomMessageEventContent
unstable-msc1767 only.sourcefn from(content: EmoteEventContent) -> Self
fn from(content: EmoteEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<FileEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc3551 only.
impl From<FileEventContent> for RoomMessageEventContent
unstable-msc3551 only.sourcefn from(content: FileEventContent) -> Self
fn from(content: FileEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<ImageEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc3552 only.
impl From<ImageEventContent> for RoomMessageEventContent
unstable-msc3552 only.sourcefn from(content: ImageEventContent) -> Self
fn from(content: ImageEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<LocationEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc3488 only.
impl From<LocationEventContent> for RoomMessageEventContent
unstable-msc3488 only.sourcefn from(content: LocationEventContent) -> Self
fn from(content: LocationEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<MessageEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc1767 only.
impl From<MessageEventContent> for RoomMessageEventContent
unstable-msc1767 only.sourcefn from(content: MessageEventContent) -> Self
fn from(content: MessageEventContent) -> Self
Converts to this type from the input type.
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<NoticeEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc1767 only.
impl From<NoticeEventContent> for RoomMessageEventContent
unstable-msc1767 only.sourcefn from(content: NoticeEventContent) -> Self
fn from(content: NoticeEventContent) -> 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 From<VideoEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc3553 only.
impl From<VideoEventContent> for RoomMessageEventContent
unstable-msc3553 only.sourcefn from(content: VideoEventContent) -> Self
fn from(content: VideoEventContent) -> Self
Converts to this type from the input type.
sourceimpl From<VoiceEventContent> for RoomMessageEventContent
Available on crate feature unstable-msc3245 only.
impl From<VoiceEventContent> for RoomMessageEventContent
unstable-msc3245 only.sourcefn from(content: VoiceEventContent) -> Self
fn from(content: VoiceEventContent) -> Self
Converts to this type from the input type.
sourceimpl RedactContent for RoomMessageEventContent
impl RedactContent for RoomMessageEventContent
type Redacted = RedactedRoomMessageEventContent
type Redacted = RedactedRoomMessageEventContent
events only.The redacted form of the event’s content.
sourcefn redact(self, version: &RoomVersionId) -> RedactedRoomMessageEventContent
fn redact(self, version: &RoomVersionId) -> RedactedRoomMessageEventContent
events only.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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
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
