This probably a very dumb question, but I was wondering if it was possible to expose a type out from a module. If this sounds vague, I hope the following info will shed light on what I want to achieve.
Let's say I have the following file structure:
Project
|-Units
| |-Length
| | |-Meter.rs
| | |-mod.rs
| |-mod.rs
|-main.rs
The Units/mod.rs file:
pub mod Length;
The Units/Length/mod.rs file:
pub mod Meter;
The Units/Length/Meter.rs file:
pub struct Meter
{
someValue: f64
}
// some implementation here
Now when I want to use the Meter struct in main, I seem to need to write the following:
let someMeter = Units::Length::Meter::Meter::new(5.3);
What I would like is to write
let someMeter = Units::Length::Meter::new(5.3);
Though I'm not sure what exactly I should change in the mod.rs files to achieve this. I don't really want to change the folder structure as I like the way it is organized. Any insight into what I'm doing wrong would be appreciated.
I acknowledge that I'm not following rust naming conventions in this example.