From 8aedc3077d46631b71d3a22750f999d79025a48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 17 Aug 2020 16:47:24 +0200 Subject: [PATCH] matrix-sdk: Add an example to the start verification method of the device. --- matrix_sdk/src/device.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/matrix_sdk/src/device.rs b/matrix_sdk/src/device.rs index f8d3d1b3..4b813af4 100644 --- a/matrix_sdk/src/device.rs +++ b/matrix_sdk/src/device.rs @@ -40,6 +40,23 @@ impl Device { /// Start a interactive verification with this `Device` /// /// Returns a `Sas` object that represents the interactive verification flow. + /// + /// # Example + /// + /// ```no_run + /// # use std::convert::TryFrom; + /// # use matrix_sdk::{Client, identifiers::UserId}; + /// # use url::Url; + /// # use futures::executor::block_on; + /// # let alice = UserId::try_from("@alice:example.org").unwrap(); + /// # let homeserver = Url::parse("http://example.com").unwrap(); + /// # let client = Client::new(homeserver).unwrap(); + /// # block_on(async { + /// let device = client.get_device(&alice, "DEVICEID".into()).await.unwrap(); + /// + /// let verification = device.start_verification().await.unwrap(); + /// # }); + /// ``` pub async fn start_verification(&self) -> Result { let (sas, request) = self.inner.start_verification(); let request = ToDeviceRequest {