This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Everything is in a single crate. The directory structure is as follows: | |
. | |
├── b | |
│ └── mod.rs | |
├── c | |
│ └── mod.rs | |
├── d | |
│ └── mod.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------- main.rs --------------------- | |
use a::b; | |
mod a; | |
mod c; | |
fn main() { | |
println!("{}", a::foo); | |
c::foobar(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you can just use | |
// `pub mod b;` | |
// if this file is a/mod.rs and | |
// if you have a file named a/b.rs or a/b/mod.rs | |
// that contains the contents inside the curly brackets | |
pub mod b { | |
pub static bar: f64 = 1.1; | |
} | |
pub static foo: int = 40; |
NewerOlder