Add a package for demonstrating modules
This commit is contained in:
parent
9f25a0ae35
commit
4f0fdba18e
5 changed files with 24 additions and 0 deletions
7
backyard/Cargo.lock
generated
Normal file
7
backyard/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "backyard"
|
||||
version = "0.1.0"
|
6
backyard/Cargo.toml
Normal file
6
backyard/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "backyard"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
1
backyard/src/garden.rs
Normal file
1
backyard/src/garden.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod vegetables;
|
2
backyard/src/garden/vegetables.rs
Normal file
2
backyard/src/garden/vegetables.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
#[derive(Debug)]
|
||||
pub struct Asparagus {}
|
8
backyard/src/main.rs
Normal file
8
backyard/src/main.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use crate::garden::vegetables::Asparagus;
|
||||
|
||||
pub mod garden;
|
||||
|
||||
fn main() {
|
||||
let plant = Asparagus {};
|
||||
println!("I'm growing {plant:?}!");
|
||||
}
|
Loading…
Reference in a new issue