title: How to destructure an enum from a transitive dependency?
body: <p>src/main.rs:</p>
  <pre class="lang-rust prettyprint-override"><code>fn main() {}
  
  fn test(fetch: imap::types::Fetch) {
      // Variable of type &amp;BodyStructure
      let bodystructure = fetch.bodystructure().unwrap();
  
      match bodystructure {
          imap_proto::BodyStructure::Basic { .. } =&gt; {}
          imap_proto::BodyStructure::Message { .. } =&gt; {}
          imap_proto::BodyStructure::Multipart { .. } =&gt; {}
          imap_proto::BodyStructure::Text { .. } =&gt; {}
      };
  }
  </code></pre>
  <p>Cargo.toml:</p>
  <pre><code>[package]
  name = &quot;stackoverflow-68445809&quot;
  version = &quot;0.1.0&quot;
  edition = &quot;2018&quot;
  
  [dependencies]
  imap = &quot;2.4.1&quot;
  
  # This dependency solves the problem
  # imap-proto = &quot;0.10.2&quot;
  </code></pre>
  <p>The code does not compile:</p>
  <pre class="lang-none prettyprint-override"><code>error[E0433]: failed to resolve: use of undeclared crate or module `imap_proto`
   --&gt; src/main.rs:8:9
    |
  8 |         imap_proto::BodyStructure::Basic { .. } =&gt; {}
    |         ^^^^^^^^^^ use of undeclared crate or module `imap_proto`
  
  error[E0433]: failed to resolve: use of undeclared crate or module `imap_proto`
   --&gt; src/main.rs:9:9
    |
  9 |         imap_proto::BodyStructure::Message { .. } =&gt; {}
    |         ^^^^^^^^^^ use of undeclared crate or module `imap_proto`
  
  error[E0433]: failed to resolve: use of undeclared crate or module `imap_proto`
    --&gt; src/main.rs:10:9
     |
  10 |         imap_proto::BodyStructure::Multipart { .. } =&gt; {}
     |         ^^^^^^^^^^ use of undeclared crate or module `imap_proto`
  
  error[E0433]: failed to resolve: use of undeclared crate or module `imap_proto`
    --&gt; src/main.rs:11:9
     |
  11 |         imap_proto::BodyStructure::Text { .. } =&gt; {}
     |         ^^^^^^^^^^ use of undeclared crate or module `imap_proto`
  </code></pre>
  <p><code>imap-proto</code> is a dependency of the <code>imap</code> crate and the code compiles after adding the dependency <code>imap-proto = &quot;0.10.2&quot;</code> to my project.</p>
  <p>Is there a method to destructure variable <code>bodystructure</code> without explicitly depending on <code>imap-proto</code> crate? The requirement to add additional dependencies only to destructure variable seems weird to me. Am I doing something wrong?</p>