rust_learning/
package_crate_use.rs1mod back_of_house {
2 pub struct Breakfast {
6 pub toast: String,
7 seasonal_fruit: String,
8 }
9 impl Breakfast {
10 pub fn summer(toast: &str) -> Breakfast {
11 Breakfast {
12 toast: String::from(toast),
13 seasonal_fruit: String::from("peaches"),
14 }
15 }
16 }
17 pub enum Appetizer {
19 Soup,
20 Salad,
21 }
22}
23
24fn eat_at_restaurant() {
25 let mut meal = back_of_house::Breakfast::summer("Rye");
27 meal.toast = String::from("Wheat");
29 println!("I'd like {} toast please", meal.toast);
30
31 }
36
37
38pub mod a {
39 pub mod b {
40 pub fn test_use_() {}
41 }
42}
43
44mod customer {
47 use crate::package_crate_use::a::b;
49 pub fn test_use_() {
50 b::test_use_();
52 super::a::b::test_use_();
54 }
55}
56
57
58use std::fmt::Result;
59use std::io::Result as IoResult;
61
62fn function1() -> Result {
63 Ok(())
65}
66
67fn function2() -> IoResult<()> {
68 Ok(())
70}