pub struct NoticeEventContent {
pub message: MessageContent,
pub relates_to: Option<Relation>,
}
events
and unstable-msc1767
only.Expand description
The payload for an extensible notice 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.
NoticeEventContent
can be converted to a RoomMessageEventContent
with a
MessageType::Notice
. You can convert it back with
NoticeEventContent::from_notice_room_message()
.
Fields
message: MessageContent
The message’s text content.
relates_to: Option<Relation>
Information about related messages.
Implementations
sourceimpl NoticeEventContent
impl NoticeEventContent
sourcepub fn plain(body: impl Into<String>) -> NoticeEventContent
pub fn plain(body: impl Into<String>) -> NoticeEventContent
A convenience constructor to create a plain text notice.
sourcepub fn html(
body: impl Into<String>,
html_body: impl Into<String>
) -> NoticeEventContent
pub fn html(
body: impl Into<String>,
html_body: impl Into<String>
) -> NoticeEventContent
A convenience constructor to create an HTML notice.
sourcepub fn markdown(body: impl AsRef<str> + Into<String>) -> NoticeEventContent
Available on crate feature markdown
only.
pub fn markdown(body: impl AsRef<str> + Into<String>) -> NoticeEventContent
markdown
only.A convenience constructor to create a Markdown notice.
Returns an HTML notice if some Markdown formatting was detected, otherwise returns a plain text notice.
sourcepub fn from_notice_room_message(
content: NoticeMessageEventContent,
relates_to: Option<Relation>
) -> NoticeEventContent
pub fn from_notice_room_message(
content: NoticeMessageEventContent,
relates_to: Option<Relation>
) -> NoticeEventContent
Create a new NoticeEventContent
from the given NoticeMessageEventContent
and optional
relation.
Trait Implementations
sourceimpl Clone for NoticeEventContent
impl Clone for NoticeEventContent
sourcefn clone(&self) -> NoticeEventContent
fn clone(&self) -> NoticeEventContent
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for NoticeEventContent
impl Debug for NoticeEventContent
sourceimpl<'de> Deserialize<'de> for NoticeEventContent
impl<'de> Deserialize<'de> for NoticeEventContent
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<NoticeEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<NoticeEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
sourceimpl EventContent for NoticeEventContent
impl EventContent for NoticeEventContent
type EventType = MessageLikeEventType
type EventType = MessageLikeEventType
sourcefn event_type(&self) -> <NoticeEventContent as EventContent>::EventType
fn event_type(&self) -> <NoticeEventContent as EventContent>::EventType
m.room.message
.sourceimpl From<NoticeEventContent> for AnyMessageLikeEventContent
impl From<NoticeEventContent> for AnyMessageLikeEventContent
sourcefn from(c: NoticeEventContent) -> AnyMessageLikeEventContent
fn from(c: NoticeEventContent) -> AnyMessageLikeEventContent
sourceimpl From<NoticeEventContent> for RoomMessageEventContent
impl From<NoticeEventContent> for RoomMessageEventContent
sourcefn from(content: NoticeEventContent) -> RoomMessageEventContent
fn from(content: NoticeEventContent) -> RoomMessageEventContent
sourceimpl RedactContent for NoticeEventContent
impl RedactContent for NoticeEventContent
type Redacted = RedactedNoticeEventContent
type Redacted = RedactedNoticeEventContent
sourcefn redact(self, version: &RoomVersionId) -> RedactedNoticeEventContent
fn redact(self, version: &RoomVersionId) -> RedactedNoticeEventContent
self
into a redacted form (removing most or all fields) according to the spec. Read more