events: impl Display for room::message::MessageFormat
This commit is contained in:
parent
a3722ca08c
commit
de337ecb8c
@ -1,5 +1,7 @@
|
|||||||
//! Types for the *m.room.message* event.
|
//! Types for the *m.room.message* event.
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_events_macros::MessageEventContent;
|
use ruma_events_macros::MessageEventContent;
|
||||||
use ruma_identifiers::EventId;
|
use ruma_identifiers::EventId;
|
||||||
@ -287,6 +289,15 @@ pub enum MessageFormat {
|
|||||||
Custom(String),
|
Custom(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for MessageFormat {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Html => f.write_str("org.matrix.custom.html"),
|
||||||
|
Self::Custom(fmt) => f.write_str(fmt),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Common message event content fields for message types that have separate plain-text and
|
/// Common message event content fields for message types that have separate plain-text and
|
||||||
/// formatted representations.
|
/// formatted representations.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user