title: Why do I get the error "there is no reactor running, must be called from the context of Tokio runtime" even though I have #[tokio::main]?
body: <p>I'm following <a href="https://docs.rs/mdns/1.1.0/mdns/" rel="noreferrer">the mdns Rust documentation</a> and pasted the example code but it throws the following error:</p>
  <pre class="lang-none prettyprint-override"><code>thread 'main' panicked at 'there is no reactor running, must be called from the context of Tokio runtime'
  </code></pre>
  <p>Here's the code that I have:</p>
  <pre class="lang-rust prettyprint-override"><code>use futures_util::{pin_mut, stream::StreamExt};
  use mdns::{Error, Record, RecordKind};
  use std::{net::IpAddr, time::Duration};
  
  const SERVICE_NAME: &amp;'static str = &quot;_googlecast._tcp.local&quot;;
  
  #[tokio::main]
  async fn main() -&gt; Result&lt;(), Error&gt; {
      // Iterate through responses from each Cast device, asking for new devices every 15s
      let stream = mdns::discover::all(SERVICE_NAME, Duration::from_secs(15))?.listen();
      pin_mut!(stream);
  
      while let Some(Ok(response)) = stream.next().await {
          let addr = response.records().filter_map(self::to_ip_addr).next();
  
          if let Some(addr) = addr {
              println!(&quot;found cast device at {}&quot;, addr);
          } else {
              println!(&quot;cast device does not advertise address&quot;);
          }
      }
  
      Ok(())
  }
  
  fn to_ip_addr(record: &amp;Record) -&gt; Option&lt;IpAddr&gt; {
      match record.kind {
          RecordKind::A(addr) =&gt; Some(addr.into()),
          RecordKind::AAAA(addr) =&gt; Some(addr.into()),
          _ =&gt; None,
      }
  }
  </code></pre>
  <p>Dependencies:</p>
  <pre><code>[dependencies]
  mdns = &quot;1.1.0&quot;
  futures-util = &quot;0.3.8&quot;
  tokio = { version = &quot;0.3.3&quot;, features = [&quot;full&quot;] }
  </code></pre>
  <p>What am I missing? I tried looking online but haven't found how to create a reactor for this use case.</p>