Closed GTime closed 3 years ago
@GTime in your Cargo.toml you have to activate the Tokio feature for act-zero
act-zero = {version = "0.4", features = ["default-tokio"]}
@GTime in your Cargo.toml you have to activate the Tokio feature for act-zero
act-zero = {version = "0.4", features = ["default-tokio"]}
I got the following errors afterwards:
You need to activate the rt
or rt-multi-thread
feature in Tokio to use spawn
tokio = {version = "1.2", features = ["rt-multi-thread", "time", "net"]}
You need to activate the
rt
orrt-multi-thread
feature in Tokio to use spawntokio = {version = "1.2", features = ["rt-multi-thread", "time", "net"]}
I made the above changes, but still having the below errors.
I am running the exact tokio example in the examples folder.
use act_zero::runtimes::tokio::spawn_actor;
use act_zero::*;
struct HelloWorldActor;
impl Actor for HelloWorldActor {}
impl HelloWorldActor {
async fn say_hello(&mut self) {
println!("Hello, world!");
}
}
#[tokio::main]
async fn main() -> Result<(), ActorError> {
let addr = spawn_actor(HelloWorldActor);
call!(addr.say_hello()).await?;
Ok(())
}
To use #[tokio::main]
you also need the macros feature on tokio
tokio = {version = "1.2", features = ["time", "rt-multi-thread", "macros"]}
To use
async main
#[tokio::main]
you also need the macros feature on tokiotokio = {version = "1.2", features = ["time", "rt-multi-thread", "macros"]}
It worked, thanks very much. Forgive me for the trouble, I'm new to rust and it's ecosystem.
Please one more question: how do I run it as blocking.
Please one more question: how do I run it as blocking.
I'm not exactly sure what you mean, but if you want to run spawn_blocking
task from tokio you need to activate the blocking
feature.
https://docs.rs/tokio/1.6.1/tokio/task/fn.spawn_blocking.html
Thanks for your help.
Hi, thanks for sharing such an amazing project.
I am interested in Actor and currently use actix. I am in search for a more flexible crate and I find act-zero amazing. I tried your tokio example but rust could not find tokio runtime.
I am fairly new to rust, please help me out with possible solutions. Thank you