Skip to content

Instantly share code, notes, and snippets.

@Dr-Emann
Created May 29, 2014 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dr-Emann/d2e7d16cf821509b9809 to your computer and use it in GitHub Desktop.
Save Dr-Emann/d2e7d16cf821509b9809 to your computer and use it in GitHub Desktop.
Rust Module Demonstration
// 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;
use a::b;
pub fn foobar() {
println!("{}", b::bar);
}
use a::b;
mod a;
mod c;
fn main() {
println!("{}", a::foo);
c::foobar();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment