From 326e705468f5f9488a69c96e54c61ac13c01432b Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 22 May 2020 17:58:25 +0200 Subject: [PATCH] Fix hello_world example --- examples/hello_world.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 33020285..254b7a5a 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -10,6 +10,7 @@ use ruma_client::{ identifiers::RoomAliasId, Client, }; +use serde_json::value::to_raw_value as to_raw_json_value; use url::Url; async fn hello_world(homeserver_url: Url, room: String) -> anyhow::Result<()> { @@ -36,13 +37,12 @@ async fn hello_world(homeserver_url: Url, room: String) -> anyhow::Result<()> { room_id, event_type: EventType::RoomMessage, txn_id: "1".to_owned(), - data: MessageEventContent::Text(TextMessageEventContent { + data: to_raw_json_value(&MessageEventContent::Text(TextMessageEventContent { body: "Hello World!".to_owned(), format: None, formatted_body: None, relates_to: None, - }) - .into(), + }))?, }) .await?;