mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
390 B
21 lines
390 B
3 years ago
|
// modules1.rs
|
||
3 years ago
|
// 让我能够编译!执行 `rustex hint modules1` 获取提示 :)
|
||
3 years ago
|
|
||
|
// I AM NOT DONE
|
||
|
|
||
|
mod sausage_factory {
|
||
3 years ago
|
// 确保它仅在当前模块可见。
|
||
3 years ago
|
fn get_secret_recipe() -> String {
|
||
|
String::from("Ginger")
|
||
|
}
|
||
|
|
||
|
fn make_sausage() {
|
||
|
get_secret_recipe();
|
||
|
println!("sausage!");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
sausage_factory::make_sausage();
|
||
|
}
|