title: Rust Import structure from another file
body: <p>Here's my file structure:</p>
  
  <pre><code>src
  ├── [2.4K]  game_of_life.rs
  ├── [1.7K]  main.rs
  └── [1.9K]  preset.rs
  </code></pre>
  
  <p>File contents:
  <code>preset.rs</code>:</p>
  
  <pre><code>pub struct Preset {
      ...
  }
  
  impl Preset {
      ...
  }
  </code></pre>
  
  <h1>Error I got</h1>
  
  <p>I tried importing <code>Preset</code> in <code>main.rs</code>:</p>
  
  <pre><code>mod preset;
  </code></pre>
  
  <p>And it worked fine.</p>
  
  <p>After that I tried to import <code>Preset</code> in <code>game_of_life.rs</code> using the same line of code, but got an error:</p>
  
  <pre><code>Error: file not found for module `preset`
  Help: name the file either game_of_life/preset.rs or game_of_life/preset/mod.rs inside the directory "src"
  </code></pre>
  
  <p>I don't understand why Rust is trying to find the <code>preset</code> in <code>game_of_life</code>.</p>
  
  <h1>What I tried to do to fix it</h1>
  
  <p>I found, that I have to wrap <code>Preset</code> in <code>pub mod preset</code>, but this didn't help me.</p>