Increment version

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/32/head
trivernis 3 years ago
parent 38342eac44
commit 18412c4a2f
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

2
Cargo.lock generated

@ -93,7 +93,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bromine"
version = "0.17.1"
version = "0.18.0"
dependencies = [
"async-trait",
"bincode",

@ -1,6 +1,6 @@
[package]
name = "bromine"
version = "0.17.1"
version = "0.18.0"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"
readme = "README.md"

@ -19,7 +19,7 @@ use tokio::net::TcpListener;
async fn handle_ping(ctx: &Context, event: Event) -> Result<()> {
println!("Received ping event.");
ctx.emit("pong", ()).await?;
Ok(())
Ok(Response::empty())
}
#[tokio::main]
@ -31,8 +31,15 @@ async fn main() {
.on("ping", callback!(handle_ping))
.build_client().await.unwrap();
// emit an initial event
let response = ctx.emit("ping", ()).await_response().await?;
// emit an event and wait for responses
let response = ctx.emit("ping", ()).await_reply().await?;
// emit an event and get all responses as stream
let stream = ctx.emit("ping", ()).stream_replies().await?;
while let Some(Ok(event)) = stream.next().await {
println!("{}", event.name());
}
}
```
@ -50,7 +57,10 @@ async fn main() {
// register callback
.on("ping", callback!(ctx, event, async move {
println!("Received ping event.");
Ok(())
for _ in 0..10 {
ctx.emit("pong", ()).await?;
}
Ok(Response::empty())
}))
.build_server().await.unwrap();
}

Loading…
Cancel
Save