summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch17-oop/listing-17-11
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch17-oop/listing-17-11')
-rw-r--r--src/doc/book/listings/ch17-oop/listing-17-11/Cargo.lock6
-rw-r--r--src/doc/book/listings/ch17-oop/listing-17-11/Cargo.toml6
-rw-r--r--src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs20
3 files changed, 32 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch17-oop/listing-17-11/Cargo.lock b/src/doc/book/listings/ch17-oop/listing-17-11/Cargo.lock
new file mode 100644
index 000000000..b6f4232c6
--- /dev/null
+++ b/src/doc/book/listings/ch17-oop/listing-17-11/Cargo.lock
@@ -0,0 +1,6 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "blog"
+version = "0.1.0"
+
diff --git a/src/doc/book/listings/ch17-oop/listing-17-11/Cargo.toml b/src/doc/book/listings/ch17-oop/listing-17-11/Cargo.toml
new file mode 100644
index 000000000..1619af5c6
--- /dev/null
+++ b/src/doc/book/listings/ch17-oop/listing-17-11/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "blog"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
diff --git a/src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs b/src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs
new file mode 100644
index 000000000..d99170a97
--- /dev/null
+++ b/src/doc/book/listings/ch17-oop/listing-17-11/src/main.rs
@@ -0,0 +1,20 @@
+// ANCHOR: all
+use blog::Post;
+
+// ANCHOR: here
+fn main() {
+ let mut post = Post::new();
+
+ post.add_text("I ate a salad for lunch today");
+ assert_eq!("", post.content());
+ // ANCHOR_END: here
+
+ post.request_review();
+ assert_eq!("", post.content());
+
+ post.approve();
+ assert_eq!("I ate a salad for lunch today", post.content());
+ // ANCHOR: here
+}
+// ANCHOR_END: here
+// ANCHOR_END: all