Currently I have a main written like the async example for the Reqwest
library.
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
We can use the exact example there for this. Now I want to basically add a -l <port>
flag to alter the behavior of my application and when triggered in such a fashion, I want it to listen on the port and run a web server. I'm wanting to use Actix Web which is documented like this,
#[actix_web::main]
async fn main() -> std::io::Result<()> {
How can I synthesize two fn main
: one decorated with #[actix_web::main]
and one decorated with #[tokio::main]
to use Actix Web from within an application that already uses Tokio? I can't find any documentation on
this? How do we go about using Tokio stuff from an Actix Web server, and how do we port a Tokio application to an Actix Web application?