events: impl Display for room::message::MessageFormat

This commit is contained in:
Jonas Platte 2020-08-11 15:08:59 +02:00
parent a3722ca08c
commit de337ecb8c
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -1,5 +1,7 @@
//! Types for the *m.room.message* event.
use std::fmt;
use js_int::UInt;
use ruma_events_macros::MessageEventContent;
use ruma_identifiers::EventId;
@ -287,6 +289,15 @@ pub enum MessageFormat {
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
/// formatted representations.
#[derive(Clone, Debug, Deserialize, Serialize)]