rustlings/exercises/modules/modules1.rs

17 lines
413 B
Rust
Raw Permalink Normal View History

2021-07-08 02:58:36 +07:00
// modules1.rs
// Make me compile! Execute `rustlings hint modules1` for hints :)
2021-07-08 03:02:31 +07:00
// `mod` defines a module which can contain functions, structs etc.
// by default, its `fn`s only limited within itself, creating "closed
// ecosystem". you can make them public with `pub`
2021-07-08 02:58:36 +07:00
mod sausage_factory {
2021-07-08 03:02:31 +07:00
pub fn make_sausage() {
2021-07-08 02:58:36 +07:00
println!("sausage!");
}
}
fn main() {
sausage_factory::make_sausage();
}