title: Using Actix from a Tokio App: mixing actix_web::main and tokio::main?
body: <p>Currently I have a main written like the <a href="https://crates.io/crates/reqwest" rel="noreferrer">async example for the <code>Reqwest</code> library</a>.</p>
  <pre><code>#[tokio::main]
  async fn main() -&gt; Result&lt;(), Box&lt;dyn std::error::Error&gt;&gt; {
  </code></pre>
  <p>We can use the exact example there for this. Now I want to basically add a <code>-l &lt;port&gt;</code> 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 <a href="https://actix.rs/" rel="noreferrer">Actix Web</a> which is documented like this,</p>
  <pre><code>#[actix_web::main]
  async fn main() -&gt; std::io::Result&lt;()&gt; {
  </code></pre>
  <p>How can I synthesize two <code>fn main</code>: one decorated with <code>#[actix_web::main]</code> and one decorated with <code>#[tokio::main]</code> 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?</p>