title: How to use Rust's async/await syntax in WASI
body: <p>I would like to compile the following code with <a href="https://github.com/bytecodealliance/cargo-wasi" rel="nofollow noreferrer">cargo-wasi</a>.</p>
  <pre class="lang-rust prettyprint-override"><code>// reqwest = { version = &quot;0.11&quot;, features = [&quot;json&quot;] }
  // tokio = { version = &quot;1&quot;, features = [&quot;full&quot;] }
  
  use std::collections::HashMap;
  
  #[tokio::main]
  async fn main() -&gt; Result&lt;(), Box&lt;dyn std::error::Error&gt;&gt; {
      let resp = reqwest::get(&quot;https://httpbin.org/ip&quot;)
          .await?
          .json::&lt;HashMap&lt;String, String&gt;&gt;()
          .await?;
      println!(&quot;{:#?}&quot;, resp);
      Ok(())
  }
  </code></pre>
  <p>After trying to compile it, I got the following error because <a href="https://github.com/tokio-rs/mio/issues/1346" rel="nofollow noreferrer">mio doesn't currently support WASI</a></p>
  <pre><code>$ cargo wasi run
     Compiling mio v0.7.9
     Compiling parking_lot v0.11.1
     Compiling serde_json v1.0.64
     Compiling idna v0.2.2
  error[E0432]: unresolved import `crate::sys::IoSourceState`
    --&gt; /home/ducaale/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.7.9/src/io_source.rs:12:5
     |
  12 | use crate::sys::IoSourceState;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `IoSourceState` in `sys`
  ... errors omitted
  </code></pre>
  <p>I did some research and none of the <a href="https://github.com/wapm-packages/rust-wasi-example/blob/master/src/main.rs" rel="nofollow noreferrer">examples</a> I found so far were utilizing async/await. Is there something I could replace <code>tokio</code> with so my code compiles in WASI?</p>