diff --git a/ruma-client/examples/hello_world.rs b/ruma-client/examples/hello_world.rs index fa49bc0d..0bd978f0 100644 --- a/ruma-client/examples/hello_world.rs +++ b/ruma-client/examples/hello_world.rs @@ -3,10 +3,7 @@ use std::{convert::TryFrom, env, process::exit}; use http::Uri; use ruma::{ api::client::r0::{alias::get_alias, membership::join_room_by_id, message::send_message_event}, - events::{ - room::message::{MessageEventContent, TextMessageEventContent}, - AnyMessageEventContent, - }, + events::{room::message::MessageEventContent, AnyMessageEventContent}, RoomAliasId, }; use ruma_client::{self, Client}; @@ -21,13 +18,7 @@ async fn hello_world(homeserver_url: Uri, room_alias: &RoomAliasId) -> anyhow::R .request(send_message_event::Request::new( &room_id, "1", - &AnyMessageEventContent::RoomMessage(MessageEventContent::Text( - TextMessageEventContent { - body: "Hello World!".to_owned(), - formatted: None, - relates_to: None, - }, - )), + &AnyMessageEventContent::RoomMessage(MessageEventContent::text_plain("Hello World!")), )) .await?; diff --git a/ruma-events/src/room/message.rs b/ruma-events/src/room/message.rs index c809fb63..9d120bb8 100644 --- a/ruma-events/src/room/message.rs +++ b/ruma-events/src/room/message.rs @@ -299,6 +299,7 @@ pub struct LocationInfo { /// The payload for a notice message. #[derive(Clone, Debug, Deserialize, Serialize)] +#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct NoticeMessageEventContent { /// The notice text to send. pub body: String, @@ -419,6 +420,7 @@ impl FormattedBody { /// The payload for a text message. #[derive(Clone, Debug, Deserialize, Serialize)] +#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct TextMessageEventContent { /// The body of the message. pub body: String,