From 54871f2af93f730a71c8647e90fde601520df69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 2 Jun 2020 11:15:04 +0200 Subject: [PATCH] matrix-sdk: Make the example for the send method comiple. --- matrix_sdk/src/client.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index e06d3eb59..2ab728cf2 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -929,20 +929,30 @@ impl Client { /// /// # Example /// - /// ```compile_fail + /// ```no_run + /// # use matrix_sdk::{Client, SyncSettings}; + /// # use futures::executor::block_on; + /// # use url::Url; + /// # use std::convert::TryFrom; + /// # block_on(async { + /// # let homeserver = Url::parse("http://localhost:8080").unwrap(); + /// # let mut client = Client::new(homeserver, None).unwrap(); /// use matrix_sdk::api::r0::profile; + /// use matrix_sdk::identifiers::UserId; /// /// // First construct the request you want to make /// // See https://docs.rs/ruma-client-api/latest/ruma_client_api/index.html /// // for all available Endpoints /// let request = profile::get_profile::Request { - /// user_id: mxid.clone(), + /// user_id: UserId::try_from("@example:localhost").unwrap(), /// }; /// /// // Start the request using Client::send() - /// let resp = client.send(request).await.unwrap(); + /// let response = client.send(request).await.unwrap(); /// - /// // Check the corresponding Response struct to find out what types are returned + /// // Check the corresponding Response struct to find out what types are + /// // returned + /// # }) /// ``` pub async fn send + std::fmt::Debug>( &self, @@ -1050,7 +1060,7 @@ impl Client { /// }); /// let txn_id = Uuid::new_v4(); /// client.room_send(&room_id, content, Some(txn_id)).await.unwrap(); - /// }) + /// # }) /// ``` pub async fn room_send( &self,