more docs

master
Devin R 2020-04-10 21:44:16 -04:00
parent c69d54e2d4
commit 6358db94c7
2 changed files with 16 additions and 7 deletions

View File

@ -486,7 +486,6 @@ impl AsyncClient {
/// .room_version("v1.0"); /// .room_version("v1.0");
/// ///
/// let mut cli = AsyncClient::new(homeserver, Some(session)).unwrap(); /// let mut cli = AsyncClient::new(homeserver, Some(session)).unwrap();
///
/// assert!(cli.create_room(bldr).await.is_ok()); /// assert!(cli.create_room(bldr).await.is_ok());
/// ``` /// ```
/// ///

View File

@ -11,9 +11,23 @@ use api::r0::room::{
/// ///
/// # Examples /// # Examples
/// ``` /// ```
/// /// # use matrix_sdk::{AsyncClient, RoomBuilder};
/// # use matrix_sdk::api::r0::room::Visibility;
/// # use url::Url;
/// # let homeserver = Url::parse("http://example.com").unwrap();
/// let mut bldr = RoomBuilder::default();
/// bldr.creation_content(false)
/// .initial_state(vec![])
/// .visibility(Visibility::Public)
/// .name("name")
/// .room_version("v1.0");
/// let mut cli = AsyncClient::new(homeserver, None).unwrap();
/// # use futures::executor::block_on;
/// # block_on(async {
/// assert!(cli.create_room(bldr).await.is_err());
/// # })
/// ``` /// ```
#[derive(Default)] #[derive(Clone, Default)]
pub struct RoomBuilder { pub struct RoomBuilder {
/// Extra keys to be added to the content of the `m.room.create`. /// Extra keys to be added to the content of the `m.room.create`.
creation_content: Option<CreationContent>, creation_content: Option<CreationContent>,
@ -169,10 +183,8 @@ mod test {
use super::*; use super::*;
use crate::{AsyncClient, Session}; use crate::{AsyncClient, Session};
use mockito::mock; use mockito::mock;
use url::Url; use url::Url;
use std::convert::TryFrom; use std::convert::TryFrom;
#[tokio::test] #[tokio::test]
@ -196,9 +208,7 @@ mod test {
.visibility(Visibility::Public) .visibility(Visibility::Public)
.name("name") .name("name")
.room_version("v1.0"); .room_version("v1.0");
let mut cli = AsyncClient::new(homeserver, Some(session)).unwrap(); let mut cli = AsyncClient::new(homeserver, Some(session)).unwrap();
assert!(cli.create_room(bldr).await.is_ok()); assert!(cli.create_room(bldr).await.is_ok());
} }
} }