summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch14-more-about-cargo/listing-14-02
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch14-more-about-cargo/listing-14-02')
-rw-r--r--src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.lock6
-rw-r--r--src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.toml6
-rw-r--r--src/doc/book/listings/ch14-more-about-cargo/listing-14-02/src/lib.rs21
3 files changed, 33 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.lock b/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.lock
new file mode 100644
index 000000000..b304dd7c7
--- /dev/null
+++ b/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.lock
@@ -0,0 +1,6 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "my_crate"
+version = "0.1.0"
+
diff --git a/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.toml b/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.toml
new file mode 100644
index 000000000..c52da0412
--- /dev/null
+++ b/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "my_crate"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
diff --git a/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/src/lib.rs b/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/src/lib.rs
new file mode 100644
index 000000000..64c9c439c
--- /dev/null
+++ b/src/doc/book/listings/ch14-more-about-cargo/listing-14-02/src/lib.rs
@@ -0,0 +1,21 @@
+// ANCHOR: here
+//! # My Crate
+//!
+//! `my_crate` is a collection of utilities to make performing certain
+//! calculations more convenient.
+
+/// Adds one to the number given.
+// --snip--
+// ANCHOR_END: here
+///
+/// # Examples
+///
+/// ```
+/// let arg = 5;
+/// let answer = my_crate::add_one(arg);
+///
+/// assert_eq!(6, answer);
+/// ```
+pub fn add_one(x: i32) -> i32 {
+ x + 1
+}