Cleanup the examples a little bit
They run fine without this code.
This commit is contained in:
parent
a0ce0a9da8
commit
5fb288fc66
@ -21,16 +21,9 @@ use tokio_core::reactor::Core;
|
|||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
// from https://stackoverflow.com/a/43992218/1592377
|
// from https://stackoverflow.com/a/43992218/1592377
|
||||||
#[macro_export]
|
|
||||||
macro_rules! clone {
|
macro_rules! clone {
|
||||||
(@param _) => ( _ );
|
(@param _) => ( _ );
|
||||||
(@param $x:ident) => ( $x );
|
(@param $x:ident) => ( $x );
|
||||||
($($n:ident),+ => move || $body:expr) => (
|
|
||||||
{
|
|
||||||
$( let $n = $n.clone(); )+
|
|
||||||
move || $body
|
|
||||||
}
|
|
||||||
);
|
|
||||||
($($n:ident),+ => move |$($p:tt),+| $body:expr) => (
|
($($n:ident),+ => move |$($p:tt),+| $body:expr) => (
|
||||||
{
|
{
|
||||||
$( let $n = $n.clone(); )+
|
$( let $n = $n.clone(); )+
|
||||||
@ -42,7 +35,7 @@ macro_rules! clone {
|
|||||||
fn hello_world(
|
fn hello_world(
|
||||||
homeserver_url: Url,
|
homeserver_url: Url,
|
||||||
room: String,
|
room: String,
|
||||||
) -> impl Future<Item = (), Error = ruma_client::Error> + 'static {
|
) -> impl Future<Item = (), Error = ruma_client::Error> {
|
||||||
let client = Client::https(homeserver_url, None).unwrap();
|
let client = Client::https(homeserver_url, None).unwrap();
|
||||||
|
|
||||||
client.register_guest().and_then(clone!(client => move |_| {
|
client.register_guest().and_then(clone!(client => move |_| {
|
||||||
|
@ -25,7 +25,7 @@ use url::Url;
|
|||||||
fn hello_world(
|
fn hello_world(
|
||||||
homeserver_url: Url,
|
homeserver_url: Url,
|
||||||
room: String,
|
room: String,
|
||||||
) -> impl Future<Item = (), Error = ruma_client::Error> + 'static {
|
) -> impl Future<Item = (), Error = ruma_client::Error> {
|
||||||
let client = Client::https(homeserver_url, None).unwrap();
|
let client = Client::https(homeserver_url, None).unwrap();
|
||||||
|
|
||||||
async_block! {
|
async_block! {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user