summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch12-an-io-project/output-only-01-with-args')
-rw-r--r--src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.lock6
-rw-r--r--src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.toml6
-rw-r--r--src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/output.txt9
-rw-r--r--src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/src/main.rs6
4 files changed, 27 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.lock b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.lock
new file mode 100644
index 000000000..88bf82d16
--- /dev/null
+++ b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.lock
@@ -0,0 +1,6 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "minigrep"
+version = "0.1.0"
+
diff --git a/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.toml b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.toml
new file mode 100644
index 000000000..64c2a3f52
--- /dev/null
+++ b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "minigrep"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
diff --git a/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/output.txt b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/output.txt
new file mode 100644
index 000000000..b48bb0e10
--- /dev/null
+++ b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/output.txt
@@ -0,0 +1,9 @@
+$ cargo run -- needle haystack
+ Compiling minigrep v0.1.0 (file:///projects/minigrep)
+ Finished dev [unoptimized + debuginfo] target(s) in 1.57s
+ Running `target/debug/minigrep needle haystack`
+[src/main.rs:5] args = [
+ "target/debug/minigrep",
+ "needle",
+ "haystack",
+]
diff --git a/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/src/main.rs b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/src/main.rs
new file mode 100644
index 000000000..ae7def53d
--- /dev/null
+++ b/src/doc/book/listings/ch12-an-io-project/output-only-01-with-args/src/main.rs
@@ -0,0 +1,6 @@
+use std::env;
+
+fn main() {
+ let args: Vec<String> = env::args().collect();
+ dbg!(args);
+}