title: How to use Rust structs from other mods
body: <p>I defined a structure in a separate file. When I want to use this I do something like this at the top of the file:</p>
  <pre class="lang-rust prettyprint-override"><code>use other_file::StructName;
  mod other_file;
  </code></pre>
  <p>When I created a function that uses</p>
  <pre class="lang-rust prettyprint-override"><code>fn test(other : StructName) {};
  </code></pre>
  <p>I get a warning about using a private type, which is fixed when I use</p>
  <pre class="lang-rust prettyprint-override"><code>fn test(other : other_file::StructName) {};
  </code></pre>
  <p>This requires a lot of extra typing though. I can also reexport the module with <code>pub use</code> but I would really like to keep it hidden.</p>
  <p>How do I correctly include modules to save typing? The Python equivalent to what I want is</p>
  <pre class="lang-python prettyprint-override"><code>from other_file import StructName
  </code></pre>
  <p>The following code explains this in two files. It is a stripped down version of some matrix math utils.</p>
  <p>geometry.rs:</p>
  <pre class="lang-rust prettyprint-override"><code>use geometry::{Vec3};
  mod geometry;
  
  #[deriving(Eq, Clone, Show)]
  pub struct Mat4 {
    data : ~[f32]
  }
  
  impl Mat4 {
  
    fn apply_Vec3(&amp;self, other : &amp;Vec3) -&gt; Vec3{
      let x = self.data[0] * other.x + self.data[1] * other.y + self.data[2] * other.z;
      let y = self.data[4] * other.x + self.data[5] * other.y + self.data[6] * other.z;
      let z = self.data[8] * other.x + self.data[9] * other.y + self.data[10]* other.z;
      Vec3::new(x, y, z)
    }
  }
  
  #[deriving(Eq, Clone, Show)]
  pub struct Transform {
    mat : Mat4
  }
  
  impl Transform {
    pub fn apply_Vec3(&amp;self, vec : &amp;Vec3) -&gt; Vec3 {
      self.mat.apply_Vec3(vec)
    }
  }
  </code></pre>
  <p>transform.rs:</p>
  <pre class="lang-rust prettyprint-override"><code>#[deriving(Eq, Clone, Show)]
  pub struct Vec3 {
    x : f32,
    y : f32,
    z : f32
  }
  impl Vec3 {
    pub fn new(x : f32, y : f32, z : f32) -&gt; Vec3 {
      Vec3{x : x, y : y, z : z}
    }
  }
  </code></pre>
  <p>When compiling with <code>rustc --test transform.rs</code> I get two errors:</p>
  <pre><code>transform.rs:25:39: 25:43 warning: private type in exported type signature, #[warn(visible_private_types)] on by default
  transform.rs:25       pub fn apply_Vec3(&amp;self, vec : &amp;Vec3) -&gt; Vec3 {
                                                        ^~~~
  transform.rs:25:48: 25:52 warning: private type in exported type signature, #[warn(visible_private_types)] on by default
  transform.rs:25       pub fn apply_Vec3(&amp;self, vec : &amp;Vec3) -&gt; Vec3 {
                                                                 ^~~~
  </code></pre>