Skip to content

Commit c77b3af

Browse files
authored
chore: update example for use with 0.6.0 (Restioson#228)
refs Restioson#222
1 parent 3714ce8 commit c77b3af

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ A tiny, fast, and safe actor framework. It is modelled around Actix (copyright a
1919
result on my development machine with an AMD Ryzen 3 3200G.
2020

2121
## Example
22+
23+
This is an example to use `xtra` with `tokio`. To compile this example it is needed to add the features `tokio` and `macros` in `Cargo.toml`.
24+
25+
```toml
26+
[dependencies]
27+
xtra = { version = "0.6.0", features = ["tokio", "macros"] }
28+
```
29+
2230
```rust
2331
use xtra::prelude::*;
2432

@@ -40,7 +48,7 @@ impl Handler<Print> for Printer {
4048

4149
#[tokio::main]
4250
async fn main() {
43-
let addr = xtra::spawn_tokio(Printer::default(), None);
51+
let addr = xtra::spawn_tokio(Printer::default(), Mailbox::unbounded());
4452
loop {
4553
addr.send(Print("hello".to_string()))
4654
.await
@@ -55,7 +63,7 @@ For a longer example, check out [Vertex](https://github.com/Restioson/vertex/tre
5563
## Okay, sounds great! How do I use it?
5664

5765
Check out the [docs](https://docs.rs/xtra) and the [examples](https://github.com/Restioson/xtra/tree/master/xtra/examples) to get started!
58-
Enabling the `tokio`, `async_std`, `smol`, or `wasm_bindgen` features is recommended in order to enable some convenience methods (such as `xtra::spawn_tokio`).
66+
Enabling the `tokio`, `macros`, `async_std`, `smol`, or `wasm_bindgen` features is recommended in order to enable some convenience methods (such as `xtra::spawn_tokio`).
5967
Which you enable will depend on which executor you want to use (check out their docs to learn more about each).
6068
If you have any questions, feel free to [open an issue](https://github.com/Restioson/xtra/issues/new) or message me on the [Rust discord](https://bit.ly/rust-community).
6169

0 commit comments

Comments
 (0)