Hi @robjtede, When I was trying to use awc to write a test client for myself, I encountered a small issue. Now, I want to try to fix it.🙋♀️
Expected Behavior
I hope to be able to directly use cargo run --example client to run awc.
Current Behavior
Currently, using the #[tokio::main] macro causes awc, which requires a single-threaded context, to fail to start and report an error.
thread 'main' panicked at awc/src/client/connection.rs:158:22:
`spawn_local` called from outside of a `task::LocalSet`
Possible Solution
Using #[actix_rt::main] instead of #[tokio::main] can solve this problem. Addtionally, I noticed that comments in other places have already been updated, but this one seems to have been overlooked.
I've already raise a PR to fix this.
https://github.com/actix/actix-web/pull/3421
Hi @robjtede, When I was trying to use
awc
to write a test client for myself, I encountered a small issue. Now, I want to try to fix it.🙋♀️Expected Behavior
I hope to be able to directly use
cargo run --example
client to runawc
.Current Behavior
Currently, using the
#[tokio::main]
macro causes awc, which requires a single-threaded context, to fail to start and report an error.Possible Solution
Using
#[actix_rt::main]
instead of#[tokio::main]
can solve this problem. Addtionally, I noticed that comments in other places have already been updated, but this one seems to have been overlooked. I've already raise a PR to fix this. https://github.com/actix/actix-web/pull/3421Your Environment