From f873a162ef451aefa4eb1588c9ba8aded6636e14 Mon Sep 17 00:00:00 2001 From: KaiserY Date: Fri, 7 Oct 2022 22:45:15 +0800 Subject: [PATCH] update listings ch07 close #654 --- .../quick-reference-example/Cargo.lock | 7 +++++++ .../quick-reference-example/Cargo.toml | 6 ++++++ .../quick-reference-example/output.txt | 5 +++++ .../quick-reference-example/src/garden.rs | 1 + .../quick-reference-example/src/garden/vegetables.rs | 2 ++ .../quick-reference-example/src/main.rs | 8 ++++++++ 6 files changed, 29 insertions(+) create mode 100755 listings/ch07-managing-growing-projects/quick-reference-example/Cargo.lock create mode 100755 listings/ch07-managing-growing-projects/quick-reference-example/Cargo.toml create mode 100755 listings/ch07-managing-growing-projects/quick-reference-example/output.txt create mode 100755 listings/ch07-managing-growing-projects/quick-reference-example/src/garden.rs create mode 100755 listings/ch07-managing-growing-projects/quick-reference-example/src/garden/vegetables.rs create mode 100755 listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs diff --git a/listings/ch07-managing-growing-projects/quick-reference-example/Cargo.lock b/listings/ch07-managing-growing-projects/quick-reference-example/Cargo.lock new file mode 100755 index 0000000..4773c20 --- /dev/null +++ b/listings/ch07-managing-growing-projects/quick-reference-example/Cargo.lock @@ -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" diff --git a/listings/ch07-managing-growing-projects/quick-reference-example/Cargo.toml b/listings/ch07-managing-growing-projects/quick-reference-example/Cargo.toml new file mode 100755 index 0000000..6e904ab --- /dev/null +++ b/listings/ch07-managing-growing-projects/quick-reference-example/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "backyard" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/listings/ch07-managing-growing-projects/quick-reference-example/output.txt b/listings/ch07-managing-growing-projects/quick-reference-example/output.txt new file mode 100755 index 0000000..e36a45e --- /dev/null +++ b/listings/ch07-managing-growing-projects/quick-reference-example/output.txt @@ -0,0 +1,5 @@ +$ cargo run + Compiling backyard v0.1.0 (file:///projects/backyard) + Finished dev [unoptimized + debuginfo] target(s) in 0.36s + Running `target/debug/backyard` +I'm growing Asparagus! diff --git a/listings/ch07-managing-growing-projects/quick-reference-example/src/garden.rs b/listings/ch07-managing-growing-projects/quick-reference-example/src/garden.rs new file mode 100755 index 0000000..6c7f9b1 --- /dev/null +++ b/listings/ch07-managing-growing-projects/quick-reference-example/src/garden.rs @@ -0,0 +1 @@ +pub mod vegetables; diff --git a/listings/ch07-managing-growing-projects/quick-reference-example/src/garden/vegetables.rs b/listings/ch07-managing-growing-projects/quick-reference-example/src/garden/vegetables.rs new file mode 100755 index 0000000..b00f785 --- /dev/null +++ b/listings/ch07-managing-growing-projects/quick-reference-example/src/garden/vegetables.rs @@ -0,0 +1,2 @@ +#[derive(Debug)] +pub struct Asparagus {} diff --git a/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs b/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs new file mode 100755 index 0000000..7a024a9 --- /dev/null +++ b/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs @@ -0,0 +1,8 @@ +use crate::garden::vegetables::Asparagus; + +pub mod garden; + +fn main() { + let plant = Asparagus {}; + println!("I'm growing {:?}!", plant); +}