pub struct Receiver { /* fields omitted */ }
Message receiver.
#![feature(async_await, await_macro, futures_api)]
#![recursion_limit = "128"]
use futures03::prelude::*;
use showdown::message::{Kind, ParsedMessage, UpdateUser};
use showdown::{connect, Result, RoomId};
use tokio::await;
use tokio::runtime::Runtime;
async fn start() -> Result<()> {
let (_, mut receiver) = await!(connect("showdown"))?;
let message = await!(receiver.receive())?;
match message.parse() {
ParsedMessage {
room_id: RoomId(""),
kind:
Kind::UpdateUser(UpdateUser {
username,
named: false,
..
}),
} => {
assert!(username.starts_with("Guest "));
}
_ => panic!(),
}
Ok(())
}
Runtime::new()
.unwrap()
.block_on_all(start().boxed().compat())
.unwrap();
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
impl<T> Typeable for T where T: Any, | |
Get the TypeId
of this object.