title: Project structure in rust -- adding extra files
body: <p>I am learning rust and am super confused at the project structure for cargo projects. I am using this <a href="https://doc.rust-lang.org/cargo/guide/project-layout.html" rel="nofollow noreferrer">page</a> (and the rust book) for reference.</p>
  <p>I am trying to separate my project for different structs so they can have their own file, similar to cpp and classes.</p>
  <p>so if I have</p>
  <pre><code>src/main.rs
  src/struct_name.rs
  </code></pre>
  <p>and I create the mod for it:</p>
  <pre><code>pub mod struct_name
  {
      pub struct _struct_name
      {}
  }
  </code></pre>
  <p>I should be able to do this in main.rs:</p>
  <pre><code>mod struct_name;
  </code></pre>
  <p>But the problem I am having is when I am trying to include external crates. For example, I'm trying to implement clap and use macros. So I do the following in igloo.rs:</p>
  <pre><code>#[macro_use]
  extern crate clap;
  use clap::{Arg, App};
  
  pub mod struct_name
  {
      pub struct _struct_name
      {//do clap things}
  }
  </code></pre>
  <p>I am given the error E0468 &quot;an 'extern crate' loading macros must be at the crate root&quot;. Does this mean I can never use macros outside of main.rs or lib.rs? How can I somehow export these functions so that I can use them in struct_name.rs? I get that I could make export functions in main.rs or lib.rs, but if I am using the mod in main.rs and lib.rs, then struct_name.rs would never see the exported functions, right?</p>