Welcome to Matt's personal website, blog, and landing page for other self-hosted software.
-
-
-
-
-
About & Contact
-
-
Email: matthew@binning.net
-
Hi, my name is Matt. I am a software engineer living in the West. My interests include software, defense, EW, drones, and data security and privacy.
-
Other personal interests of mine include linguistics, philosophy, and theology, to name a few.
-
This website serves as a space to share musings, stories, and chronicles, about all of those things.
-
The Copper Chronicle contains stories and memories from various trips and experiences. More to come as this site develops.
-
-
-
-
-
Genealogy
-
-
The title of this website you may recognize as a surname. I am also interested in family history and genealogy. If you have some relation or interest to this surname, please feel free to reach out. I am planning a genealogical project.
Experienced software engineer with expertise in systems engineering, cloud infrastructure, and full-stack development. Passionate about building reliable, scalable solutions using modern technologies.
-
-
-
-
Technical Skills
-
-
-
Languages
-
-
Rust
-
Python
-
Go
-
JavaScript/TypeScript
-
HTML/CSS
-
-
-
-
Systems & Infrastructure
-
-
Linux/NixOS
-
Docker
-
Nginx
-
Git
-
CI/CD
-
-
-
-
Frameworks & Tools
-
-
Rocket (Rust)
-
React
-
Node.js
-
PostgreSQL
-
RESTful APIs
-
-
-
-
-
-
-
Professional Experience
-
-
-
Software Engineer
-
Example Company • 2020 - Present
-
-
Designed and implemented scalable backend services using Rust and Python
-
Managed infrastructure using NixOS and containerization technologies
-
Built and maintained CI/CD pipelines for automated testing and deployment
-
Collaborated with cross-functional teams to deliver high-quality software solutions
-
-
-
-
-
Systems Administrator
-
Previous Company • 2018 - 2020
-
-
Maintained Linux-based server infrastructure and monitoring systems
-
Automated routine tasks using shell scripting and Python
-
Implemented security best practices and access control policies
-
Provided technical support and documentation for development teams
-
-
-
-
-
-
Education
-
-
Bachelor of Science in Computer Science
-
University Name • 2014 - 2018
-
Focus on software engineering, algorithms, and systems programming.
-
-
-
-
-
Projects
-
-
Self-Hosted Infrastructure
-
Designed and deployed a complete self-hosted solution including:
-
-
Git hosting with Forgejo
-
Web server with Nginx and SSL/TLS
-
Calendar and contacts sync with Radicale
-
Declarative configuration management with NixOS
-
-
-
-
-
Personal Website & Blog
-
Built a simple, reliable website using primitive technologies (HTML/CSS) focused on performance and maintainability.
This URL is invalid, sorry. Please use the navigation bar or search to continue.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/README.md b/src/README.md
new file mode 100644
index 0000000..d24aa48
--- /dev/null
+++ b/src/README.md
@@ -0,0 +1,17 @@
+# Welcome
+
+Welcome to my personal website, blog, and landing page for other self-hosted software. This website serves as a space to share musings, stories, and chronicles, about all of those things.
+
+
+
+## About
+
+My name is Matt. I am a software engineer living in the West. My interests include software, defense, EW, drones, and data security and privacy. Other personal interests of mine include linguistics, philosophy, and theology, to name a few.
+
+## Genealogy
+
+The title of this website you may recognize as a surname. I am also interested in family history and genealogy. If you have some relation or interest to this surname, please feel free to reach out. I am planning a genealogical project.
+
+## Contact
+
+**Email:** matthew@binning.net
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
new file mode 100644
index 0000000..c310eb0
--- /dev/null
+++ b/src/SUMMARY.md
@@ -0,0 +1,147 @@
+# The Bin
+
+[Welcome](README.md)
+
+---
+
+# Blog
+
+- [Reflections]()
+ - [Celtic Camping](reflections/celtic_camping.md)
+ - [On Mycotoxins](reflections/mycotoxins.md)
+ - [Stack Semantics](reflections/stack_semantics.md)
+- [Events]()
+ - [Future Trips](future_trips.md)
+- [Book Reports]()
+ - [Deep Work](book_reports/deep_work.md)
+ - [The Rust Programming Language](book_reports/the_rust_programming_language.md)
+
+---
+
+# Cooking
+
+- [Menu](menu.md)
+- [Cookbook](recipes/README.md)
+ - [Beverages](recipes/beverages/README.md)
+ - [Pour-Over Black Coffee](recipes/beverages/pour-over-black-coffee.md)
+ - [London Fog](recipes/beverages/london-fog.md)
+ - [French Press Black Coffee](recipes/beverages/french-press-black-coffee.md)
+ - [Milkshake](recipes/beverages/milkshake.md)
+ - [Appetizers](recipes/appetizers/README.md)
+ - [Artichoke Spinach Dip](recipes/appetizers/artichoke-spinach-dip.md)
+ - [Bacon Wrapped Dates](recipes/appetizers/bacon-wrapped-goat-cheese-stuffed-dates.md)
+ - [Baked Goods](recipes/baked-goods/README.md)
+ - [Banana Chocolate Chip Bread](recipes/baked-goods/banana-chocolate-chip-bread.md)
+ - [Chocolate Mint Protein Gunk Bars](recipes/baked-goods/chocolate-mint-protein-gunk-bars.md)
+ - [Zucchini and Chocolate Chip Bread](recipes/baked-goods/zucchini-and-chocolate-chip-bread.md)
+ - [Carrot, Fig, Macadamia Bread](recipes/baked-goods/carrot-fig-macadamia-bread.md)
+ - [Purple Potato, Pecan Bread](recipes/baked-goods/purple-potato-pecan-bread.md)
+ - [Breakfast](recipes/breakfast/README.md)
+ - [German Pancakes](recipes/breakfast/german-pancakes.md)
+ - [Pancake, Fried Ham, Runny Egg, & Avocado](recipes/breakfast/pancake-fried-ham-runny-egg-avocado.md)
+ - [Egg Scramble](recipes/breakfast/egg-scramble-sweet-potato-black-bean-ground-beef.md)
+ - [Proplto Pancakes](recipes/breakfast/protein-purple-potato-pancakes.md)
+ - [Meals](recipes/meals/README.md)
+ - [Meatloaf, Purple Cabbage Slaw, & Parsnip Puree](recipes/meals/meatloaf-purple-cabbage-slaw-parsnip-puree.md)
+ - [Pistachio Liver Burgers](recipes/meals/pistachio-encrusted-liver-burgers.md)
+ - [Greek Bowls](recipes/meals/greek-bowls.md)
+ - [Miso Oats with Ground Beef](recipes/meals/miso-oats-with-ground-beef.md)
+ - [Salmon Bowl](recipes/meals/salmon-bowl.md)
+ - [Pad Se Ew](recipes/meals/pad-se-ew.md)
+ - [Sushi](recipes/meals/sushi.md)
+ - [Pesto Chicken and Spaghetti Squash](recipes/meals/pesto-chicken-and-spaghetti-squash.md)
+ - [Steak & Air-Fried Broccoli](recipes/meals/steak-and-air-fried-broccoli.md)
+ - [Apple Salmon Salad](recipes/meals/apple-salmon-salad.md)
+ - [Peanut Butter Chicken](recipes/meals/peanut-butter-chicken.md)
+ - [Sides](recipes/sides/README.md)
+ - [Stuffing](recipes/sides/stuffing.md)
+ - [Vinaigrette](recipes/sides/vinaigrette.md)
+ - [Kale Dish](recipes/sides/kale-dish.md)
+ - [Roasted Vegetables](recipes/sides/roasted-vegetables.md)
+ - [Cabbage Steaks](recipes/sides/cabbage-steaks.md)
+ - [Coconut Rice](recipes/sides/coconut-rice.md)
+ - [Slow Cooker](recipes/slow-cooker/README.md)
+ - [Beef Kombucha Squash Red Curry](recipes/slow-cooker/beef-kombucha-squash-red-curry.md)
+ - [Balsamic Chicken and Sausage](recipes/slow-cooker/balsamic-chicken-and-sausage.md)
+ - [Pot Roast](recipes/slow-cooker/pot-roast.md)
+ - [Chicken Sweet Yellow Curry](recipes/slow-cooker/chicken-sweet-yellow-curry-with-cauliflower-rice.md)
+ - [Beef Shank and Lentil Indian Curry](recipes/slow-cooker/beef-shank-and-lentil-indian-curry.md)
+ - [Pork Roast or Ribs with Butternut Squash](recipes/slow-cooker/pork-roast-or-ribs-with-butternut-squash.md)
+ - [Gumbo](recipes/slow-cooker/gumbo.md)
+ - [Lamb Roasted Roman Style](recipes/slow-cooker/lamb-roasted-roman-style.md)
+ - [Taco Soup](recipes/slow-cooker/taco-soup.md)
+ - [Turkey Chili](recipes/slow-cooker/turkey-chili.md)
+ - [Chicken Tortilla Soup](recipes/slow-cooker/chicken-tortilla-soup.md)
+ - [Oxtail Stew](recipes/slow-cooker/oxtail-stew.md)
+ - [Desserts](recipes/desserts/README.md)
+ - [Ruby Cake](recipes/desserts/ruby-cake.md)
+ - [Pumpkin Pie](recipes/desserts/pumpkin-pie.md)
+ - [Roasted Peaches](recipes/desserts/roasted-peaches-with-honey-mint-and-ice-cream.md)
+ - [Red Wine Pears](recipes/desserts/red-wine-pears.md)
+ - [Chocolate Fat Bomb Cookies](recipes/desserts/chocolate-fat-bomb-cookies.md)
+ - [Mug Cakes](recipes/desserts/mug-cakes.md)
+ - [Seasonal](recipes/fall/README.md)
+ - [Miso Maple Acorn Squash](recipes/fall/miso-maple-acorn-squash.md)
+ - [Delicata Squash with Parmesan](recipes/fall/delicata-squash-with-parmesan.md)
+ - [Roasted Kabocha Squash](recipes/fall/roasted-kabocha-squash.md)
+ - [Butternut Squash Soup](recipes/fall/butternut-squash-soup.md)
+ - [Spiced and Diced Sweet Potatoes](recipes/fall/spiced-and-diced-sweet-potatoes.md)
+ - [Eggnog](recipes/christmas/eggnog.md)
+ - [Gingerbread Fruitcake Muffins](recipes/christmas/gingerbread-fruitcake-muffins.md)
+ - [Based Meatloaf](recipes/christmas/based-meatloaf.md)
+ - [Corned Beef and Cabbage](recipes/st-patricks-day/corned-beef-and-cabbage-2025.md)
+ - [Corned Beef](recipes/st-patricks-day/corned-beef-2024.md)
+ - [Irish Lamb Root Stew](recipes/st-patricks-day/irish-lamb-root-stew-2025.md)
+ - [Irish Soda Bread](recipes/st-patricks-day/irish-soda-bread-2024.md)
+ - [Irish Green Milkshake](recipes/st-patricks-day/irish-green-milkshake-2025.md)
+ - [Irish Whiskey Coffee](recipes/st-patricks-day/irish-whiskey-coffee-2024.md)
+ - [Goat Root Stir Fry](recipes/earth-day/goat-root-stir-fry.md)
+ - [Compote](recipes/earth-day/compote.md)
+ - [Camping](recipes/camping/README.md)
+ - [Cobblestacks v2](recipes/camping/cobblestacks-v2.md)
+ - [Shepherd's Pie](recipes/camping/shepherds-pie.md)
+ - [Curried Cashew Couscous with Chicken](recipes/camping/curried-cashew-couscous-with-chicken.md)
+ - [Miso Salmon & Rice](recipes/camping/miso-salmon-and-rice.md)
+ - [Thanksgiving Meal](recipes/camping/thanksgiving-meal.md)
+ - [Jerky](recipes/camping/jerky.md)
+ - [Veggie Bread](recipes/camping/veggie-bread.md)
+ - [Protein Gunk](recipes/camping/protein-gunk.md)
+ - [Miscellaneous](recipes/misc/README.md)
+ - [Balsamic Glazed Brussels Sprouts](recipes/misc/balsamic-glazed-brussels-sprouts.md)
+ - [Bone Broth](recipes/misc/bone-broth.md)
+
+---
+
+# 🔒 Authentication Required
+
+- [The Copper Chronicle](copper_chronicle.md)
+ - [2024]()
+ - [Prelude](private/copper-chronicle/chapter_0/index.md)
+ - [Big Sur Adventure](private/copper-chronicle/chapter_1/big_sur.md)
+ - [📷 Big Sur Photos](private/copper-chronicle/chapter_1/photos.md)
+ - [San Luis Obispo](private/copper-chronicle/chapter_2/san_luis_obispo.md)
+ - [Her Birthday](private/copper-chronicle/chapter_3/her_birthday.md)
+ - [📷 Independence Day](private/copper-chronicle/chapter_4/independence_day.md)
+ - ["Mundane" Date]()
+ - [A Beach Wedding]()
+ - [Apple Hill](private/copper-chronicle/chapter_apple_hill/index.md)
+ - [Dove Hunting](private/copper-chronicle/chapter_7/dove_hunting.md)
+ - [📷 Dove Hunting Photos](private/copper-chronicle/chapter_7/photos.md)
+ - [Scouting](./chapter_7/scouting.md)
+ - [Frog Water](./chapter_7/frog_water.md)
+ - [Dragon's Milk](./chapter_7/dragons_milk.md)
+ - [Retrospective](./chapter_7/retrospective.md)
+ - [📷 Shasta & Dunsmuir](private/copper-chronicle/chapter_8/shasta_trip.md)
+ - [A Russian Wedding]()
+ - [Candlelight Concert](./chapter_10/README.md)
+ - [Thanksgiving](private/copper-chronicle/chapter_thanksgiving/index.md)
+ - [Melodrama](private/copper-chronicle/chapter_melodrama/index.md)
+ - [2025]()
+ - [New Years](private/copper-chronicle/2025_new_years/index.md)
+ - [Saint Patrick's Day](private/copper-chronicle/2025_saint_patricks/index.md)
+ - [May](private/copper-chronicle/2025_may/index.md)
+ - [Matheney Reunion](private/copper-chronicle/2025_matheney_reunion/index.md)
+ - [2026]()
+ - [Mission Family Statement](private/copper-chronicle/mission_family_statement.md)
+ - [ROM](private/copper-chronicle/ROM.md)
+- [Resume](private/resume.md)
diff --git a/src/book_reports/fasting_j_franklin.md b/src/book_reports/fasting_j_franklin.md
new file mode 100644
index 0000000..87700c5
--- /dev/null
+++ b/src/book_reports/fasting_j_franklin.md
@@ -0,0 +1,248 @@
+# Synthesis of Fasting by J. Franklin
+
+## Practice of Fasting
+
+### How to Fast
+
+Taper off food intake when preparing.
+Try to drink at least 1 gal of purified water throughout the first day.
+
+**Remain modest (or in secret) while fasting.** (Matthew 6:1-18)
+Basically, virtue signaling like the pharisees takes away all blessing from it.
+
+Humble yourself rather than give a performance of strife, anger, and lashing out.
+This may mean taking responsibility, praying for protection and healing, even protection from oneself, and repenting for mistakes and sins, and wrongheadedness.
+
+Enter a fast having repented of any known sins.
+Fasting will bring even hidden things to the surface so you can repent.
+
+**Combine fasting with prayer and reading the Word.**
+Fasting is a continual prayer.
+
+Fast from coffee for 40 days, then see what addiction remains.
+
+#### Fasting and Mourning
+
+> Men and beast wore sackcloth while fasting and cried mightily to God as part of repentance.
+> -John 3:7-9
+
+"Mourn" and "fast" are interchangeable in the bible (maybe somewhat).
+_Citation is needed here._
+
+**Fast for a specific purpose.**
+The focus of fasting is on God and "lovesickness" for Him rather than our own physical needs or what we stand to gain.
+
+**While fasting, pray and focus on the needs of others.**
+Prayer that goes along with fasting is a time to "press into God".
+
+Fast especially for the "little ones" (children), or probably anyone vulnerable, especially in wicked times.
+
+**Fast for a member of the family (or friend) if something is/has gone wrong with/for them.**
+This is what a church might do.
+
+_Is it worth considering just wearing a plain white T-shirt and jeans, as some equivalent to sackcloth?_
+
+#### Monitoring
+
+> There is nothing more worrisome than fasting.
+
+> Fasting is easier with grace.
+
+**Monitor how you are doing, and pray about it.**
+
+> If you want to please God, believe God.
+
+> Faith and patience must go together.
+
+**Pray about it, believe the promises, and have patience.**
+We do not need even much faith for miracles, only as _small_ as a mustard seed. (Matt 17:20)
+Christ said so, and though Peter had little faith, with that he was able to walk on water for a time.
+
+### When to Fast
+
+**Fast all day before church to sensitize oneself to church.**
+
+**Fast at the beginning of the year to set the tone for the rest of the year.**
+This is like giving the first part to God of every day, week, dollar, and consideration in decisions.
+This is Matt 6:33 -- Seek _first_ the Kingdom...
+Know that there is never a convenient time to fast.
+
+## Types of Fasts
+
+Scripture has:
+- Absolute: taking in nothing, including water.
+- Normal: no food for some amount of days. Clear broth and juices may be allowed.
+- Partial: usually certain foods or drinks for an extended period of time.
+- Daniel: eliminate meats, breads, and sweets for 21 days.
+
+Significant lengths in the Bible are 3, 7, 21, and 40 days.
+Half day and full day are also seen.
+
+## Beyond Fasting
+
+Fasting is only one tool or step in the process of [[#sanctification]].
+
+But a man is the priest of his home and has many duties and pursuits.
+
+**Exercise sanctification daily** by _practicing purity_ and being _set apart from the world and from sin_.
+
+> Exhort one another daily to not fall to a hardened heart by sin and depart from God due to an evil heart of unbelief.
+> -Heb 3:12-13
+
+This implies:
+
+**Surround yourself with a desirable and motivating community.**
+**Exhort and ask to be exhorted.**
+**Pray with purpose and for exhortation from God in the mornings.**
+
+## Purpose of Fasting
+
+### Physical
+
+#### Healing
+
+**Howbeit this kind goeth not out but by prayer and fasting** Matthew 17:20-21
+Matthew 17:20 - With this, nothing is impossible.
+
+Isaiah 58:8 - Healing will follow fasting.
+
+Water is the flushing agent.
+Urine turns darker.
+Impurities and poisons are "burnt for energy".
+Headaches are a sign that fasting was/is needed.
+
+Cognition and senses improve.
+Addictions are broken.
+
+Chronic or severe health conditions can improve with long fasts.
+There is an allegory of Christ's fasting for 40 days:
+Flies represent demons, and cancer and mold may represent corruption.
+Flies' life cycles range from 1 to 40 days.
+To utterly destroy them, you have to spray pesticides for 40 days.
+
+#### Poverty Mitigation
+
+Fasting mitigates poverty, probably by saving time on cooking, eating, doing dishes, cleaning, cutting out grocery expenses, and other un-necessities.
+
+Fasting breaks us from routine.
+
+Fasting helps you discern what you need from what you want.
+
+Fasting can end demonic attacks and break generational curses -- By this, the author means we can give ourselves space and time to disrupt our self-destructive patterns that harm us generationally.
+
+### Spirtual
+
+Worry more about your spirit than about food or clothing. (Matt 6:25)
+
+#### Sensitization
+
+Fasting is useful in getting direction from God.
+Fasting in increasing sensitivity allows us to hear "secrets", i.e. plans, secrets, and knowledge of God.
+
+Among the trinity, fasting increases closeness with the Holy Spirit.
+Fasting makes one particularly more sensitive to the timing and voice of the Holy Spirit.
+
+As in Mark 2:22, fasting is what renews our bodies as wineskins.
+It follows that the blood of Christ is the new wine.
+
+Matthew 6 -- God rewards openly for praying, fasting, and giving.
+Ecclesiastes 4:12 - Solomon describes this as the _threefold chord_ of prayer, fasting, and giving.
+
+Fasting gets us away from our own desires that we might know His.
+As you fast, it becomes less about you.
+
+#### Worship
+
+Fasting is a continual form of worship, and an offering of oneself as a living sacrifice. See ROM 12:1
+Worship, as in fasting, magnifies God and so reduces the apparent size of your problems.
+
+We need to stop measuring our God by the size of our problems, and instead by how great He is.
+
+#### The Mind
+
+It also allows you to release unforgiveness and bitterness.
+
+Mutual assurance/care while fasting for others fulfills the Law of Christ and is corrective to pride. (Gal 6:1-3)
+However, one must be trained with tender hands.
+
+Fasting positions us and prepares us for what is to come.
+
+Fasting sharpens the Word in your heart and on your tongue.
+
+One may not walk into all His promises at once, but over time.
+
+#### Addictions
+
+Fasting also helps break sexual addictions and perversions.
+One mechanism is probably related to lowering sex drive.
+
+#### Sanctification
+
+Sanctification is the process of becoming more holy or Christlike.
+Theologically, it is allowing the Holy Spirit to make us more Christlike in what we do, think, and desire.
+
+> If God has blessed your life, you are in critical need of sanctification.
+
+Over time after initial acceptance of Christ, complacency and hidden sins build up.
+If we are to see God's wonders, like the Israelites toward the Promised Land, we must confront sin in our lives and live holy.
+
+Fasting is an essential means of sanctification, or pulling yourself away from the world.
+It filters your life, between serving the spirit and serving "the flesh" (Gal 5:19-21).
+In other words, it cuts away dead things and hidden sins, i.e. circumcision of the heart.
+
+## Spiritual Premises for Fasting
+
+Matthew 5:6 - Spiritual "hunger" and "thirst" are mentioned in-place of earthly eating and drinking in scripture.
+This is fasting.
+
+Jesus fasted despite having power, because some supernatural release happens with it.
+Luke 5:34-35 - then they will fast in those days (when Jesus is taken away).
+
+Jesus never healed anyone until after he fasted 40 days.
+
+Matt 26:29 - Technically Christ is fasting until the end times, when he drinks with us in His Father's Kingdom.
+
+Acts 10:30-31 - Fasting is what opened the door (in part) to the gentiles via Cornelius.
+
+> To loose the bonds of wickedness
+> -Isa 58:6-7
+
+By making do with less, we become less dependent on the world's offerings and demands, and so we shrink/thin, and the shackles loosen.
+
+### Gluttony
+
+Our stomachs are metaphorically the bottomless pit.
+Heb 12:15-17 -- Esau lost his birthright partly due to hunger and not fasting.
+
+### Manna
+
+Manna apparently was perfectly balanced, so that there was not one sick or feeble person among them for 40 years.
+Despite this, people were not content.
+
+Kibroth Hattaavah was the result, where quail was sent and people grew sick on it.
+
+## Trivia
+
+TODO: Revise this with See Also
+
+John 14:30 - Christ points out that the enemy is the ruler of this world, but he is apart from him.
+40 represents cleansing and purifying.
+"Revival" includes in Joel 2:28 prophesying, dreaming dreams, and seeing visions.
+Heb 4:16 - the throne of grace is a canonical object.
+Heb 411:13 - " division of soul and spirit"
+2 Chronicles 7:14 - about healing, including prayer in the process (but not fasting)
+Ps 24:3-4 - This is God's place because he is so far above us. But we think to put ourselves there because our casual ego blinds us.
+Heb 11:5 - God translated Enoch.
+Heb 11:16 - You must believe that God is a rewarder.
+Jude 14-15 - Enoch did not try to please people.
+
+## See Also
+
+101 Reasons to Fast - Bob Rodgers
+Toxic Relief - Don Colbert
+Dr. Tanner was supposedly someone who had miraculous transformations with long fasts.
+Children of light - Eph 5:8-10
+The World Hunger Movement has a program called " Let it Growl".
+The Hall of Faith is another canonical object.
+"God is no respecter of persons."
+Healing evangelists include Smith Wigglesworth. (A.C. Had a book of his.)
diff --git a/src/book_reports/the_rust_programming_language.md b/src/book_reports/the_rust_programming_language.md
new file mode 100644
index 0000000..d33758f
--- /dev/null
+++ b/src/book_reports/the_rust_programming_language.md
@@ -0,0 +1,1752 @@
+# The Rust Programming Language
+
+These are my notes as I go through the main Rust book.
+
+My goal is that these notes be a "living" document.
+As I program more and more in Rust, I will update these notes.
+I will remove the obvious stuff people can grasp quickly.
+I will then add more info on nuances I uncover.
+
+## 1 Getting Started
+
+https://doc.rust-lang.org/book/
+
+These are the interesting tidbits that stand out from the book.
+
+Rust is an "expression based" language.
+File extension is .rs.
+
+rustc
+rustfmt
+rustdoc
+
+## 2 Programming a Guessing Game
+
+This introduces a basic REPL.
+
+Why is `std::cmp::Ordering` used for basic comparison of numbers?
+
+### `.expect()` and `Result`
+
+`Result`is a type-parameterized enum.
+These kinds of enums have variants of `Ok` and `Err`.
+`.expect()` may be called on a `Result` type.
+This will either unwrap it or fail with a message.
+
+`{var}` is the "crab pincer" syntax for `println!`
+
+## 3 Common Programming Concepts
+
+### 3.1 Variables and Mutability
+
+`const` is basically `constexpr`; its value/definition must be known at compile time.
+Normal variables are constants (immutable).
+`mut` are "normal", mutable variables.
+
+#### Variable Types
+
+##### Mutable
+
+`let mut = ` for a variable proper
+
+##### Immutable
+
+`let = ` for an immutable.
+These are clutch in applying transformations through shadowing.
+
+##### Constants
+
+Compared to variables (even immutable), constants can only be set to a constant expression, and they can be declared in any scope.
+
+Shadowing lets you:
+
+1. Reuse names.
+2. Hide values in higher-scopes when you might be using a value derived from it in a narrower scope.
+3. "Change" the type of the variable (cannot do this by mutating a variable).
+4. Basically mutate it, but it is explicit, and it becomes implicitly immutable again immediately.
+
+### 3.2 Data Types
+
+`isize` and `usize` are word-length for the compile target's architecture.
+
+A byte literal `b'A'` is specifically for u8 bytes.
+
+When compiled with `--release`, integers will overflow.
+Otherwise the program panics.
+Overflowing can be handled differently with methods:
+
+- `wrapping_*`
+- `checked_*`
+- `overflowing_*`
+- `saturating_*`
+
+Rust's `char` is 4 bytes and represents a Unicode scalar value.
+It ranges from `U+0000` to `U+D7FF` and `U+E000` to `U+10FFFF` inclusive.
+
+#### Ranges
+
+inclusive-exclusive: `START...END`
+inclusive-inclusive: `START...=END`
+
+#### Tuples
+
+Tuples are a primitive, compound type and allow destructuring.
+Indexing is also possible with a dot operator.
+```rust
+let tup = (1, 2.0, false);
+let (x, y, z) = tup;
+let y = tup.0;
+```
+
+The `()` empty tuple is called _unit_.
+This is like `void` in that it is returned implicitly if there are no other returns.
+
+#### Arrays
+
+Arrays are defined on the stack and have a fixed length.
+Otherwise you will need a vector.
+
+Arrays can be initialized either as `[type; length]` or `[value; length]` with
+the latter's value being repeated.
+
+### 3.3 Functions
+
+Parameters must have a type annotation.
+`fn foo(some_var : i32){}`
+
+Expressions' return value is their final expression.
+
+```Rust
+{
+ let x = 2;
+ x + 6
+} // returns 8
+```
+
+Of course, these are used as function bodies.
+
+### 3.4 Comments
+
+`//` comments can be inline.
+`///` are documentation comments (Markdown-ready which compile to HTML through Cargo).
+Panics, Errors, Safety, and Examples are common headings.
+`//!` adds commentary to the containing item (such as a crate or module) rather than the below piece of code.
+
+### 3.6 Macros
+
+`fn foo!(){}`
+
+`dbg!()` is a useful macro to print debug information of arguments and simultaneously return ownership.
+
+### 3.5 Control Flow
+
+`if` is an expression (with "arms" like match) so it may be used as a ternary.
+`let number = if condition { 5 } else { 6 };`.
+Because of this, all arms must return the same type.
+
+#### Loops
+
+`loop`, `while`, and `for`
+`for` is basically an enhanced for loop in C/++.
+
+```Rust
+ [expression] {
+ ; {STATEMENTS}...
+}
+```
+
+Loops can have labels.
+
+```Rust
+'label: loop {
+
+}
+```
+
+You can break on these so to not break on the innermost loop.
+
+`break 'label;`
+
+You can return a value to make a loop an expression on a break.
+
+`break some_val;`
+
+With `loop`s, a value may be added to the end of the `break` statement to return a value.
+This means the loop is an expression and can be assigned from.
+
+Loops may have labels `'label: loop { ...; break 'label; }` to specify non-innermost breaks.
+
+`while` loops are also available.
+
+`for` loops are more like C++ enhanced for loops.
+
+They're also like Python for loops with a range type.
+Ranges are provided by the standard library and apparently the literal looks like `(x..y)`.
+
+## 4 Understanding Ownership
+
+### 4.1 What is Ownership?
+
+String literals are on the stack, but `String`s are allocated to the heap.
+Thus string literals are constexpr, basically.
+Because Strings are on the heap, `String::push_str(self, str)` is the name of the appending function.
+
+**Memory is automatically returned once the variable that owns it goes out of scope.**
+This pattern is called RAII (resource acquisition is initialization) in C++.
+The actual "free" function called in rust at the end of scope is called `drop`.
+This means there must be only one "owner".
+
+Double free error: Another pointer to the same data on a heap goes out of scope.
+
+Assigning one variable to another is actually an ambiguous operation.
+
+On the heap:
+
+Instead of `shallow copy`s (copying structured data and pointer values), rust performs `move`s.
+The first variable becomes invalidated.
+Rust never automatically performs deep copies (`clone()`) which would copy all member pointers blocks of memory.
+Some data implements `Clone` though, then `.clone()` will perform a deep copy.
+
+stack-only data:
+
+If all data is on the stack, there is no difference between a deep and shallow copy.
+Thus, if stack-only data implements `copy()`, no `move` occurs, just copy semantics.
+The primitives types and tuples of only primitives implement the Copy trait.
+
+#### Ownership and Functions
+
+Passing arguments to parameters uses the exact same ambiguous semantics as variable assignments.
+
+If anything is moved in rather than copied in, the drop at the end of the function scope could be problematic.
+You _could_ return a tuple with the extra values of anything moved in to move it back out.
+That's "too much ceremony" though, so you get references.
+
+### 4.2 References and Borrowing
+
+You can have as many immutable references to a variable as you like.
+Once you have an immutable reference, that's the only reference you can have of it for the remainder of its scope.
+
+A scope of a reference ends with its last usage, so a scope is not strictly a syntactic block. It can be confusingly more forgiving.
+
+### 4.3 The Slice Type
+
+A "string slice" is `&str` and the literal looks like `&s[0..len]`.
+The inclusive beginning and exclusive ending can be omitted, i.e. `&s[..]`.
+Indices can be variables, e.g. `&s[2..i]`.
+
+Immutable borrows of slices help ensure that the underlying data is not mutated later.
+This is as opposed to calculating some index and storing it in an unrelated variable.
+
+Slicing can be performed on either `&String` or string slices `&str`.
+Deref coercion can implicitly convert a string reference to a string slice.
+
+References to strings are equivalent to whole slices of strings.
+String literals are string slices.
+
+There is a type for a general slice of a collection.
+It has a type of the form `&[i32]`.
+
+One can take a slice of a string or an array.
+A string slice is `&str` (not to be confused with the more specialized &String).
+
+An array slice type is something like `&[i32]`.
+An array slice literal is something like `&a[1..3]`
+
+### 4.4 Cloning
+
+Copying stack allocations (most primitives) gives you a copy.
+Copying heap allocations (boxes/pointers) gives you a shallow copy.
+It also _invalidates_ the original copy.
+To do a deep copy, call `.clone()`.
+
+## 5 Using Structs to Structure Related Data
+
+_Field Init Shorthand_ lets us pass arguments that match the name of a struct field without specifying the struct field.
+
+```Rust
+fn factory(some_field : fieldType) -> Some_Struct {
+ Some_Struct {
+ some_field,
+ some_field2 : some_field_other,
+ }
+};
+```
+
+_Struct update syntax_ lets us create a struct by specifying a struct to base the rest of the values on (after explicitly setting some values).
+This syntax will move or copy individual fields to the new struct, so some fields of the old struct may become unusable.
+
+```rust
+let another_struct = Some_Struct {
+ field1 : val1
+ ..old_struct
+};
+```
+
+Tuple structs, e.g. `struct Point(i32, i32)` are like structs without names for fields.
+They let you define distinct types, but give you the dot operator and indexing of tuples.
+
+```Rust
+struct Color(u8, u8, u8, u8);
+let color = Color(0,1,2,3);
+```
+
+Order matters and they can be destructured, like tuples.
+Field names are not provided.
+Dot access operator is also valid.
+
+_Unit-like structs_ are structs with no fields.
+They can simply serve as a basis to implement traits on.
+
+```Rust
+struct UnitStruct;
+let unit_struct = UnitStruct;
+```
+
+These are probably good for defining traits on.
+
+Storing references in a struct requires the use of lifetimes.
+
+`println!(structure:?)` is permissible if the structure implements `Debug`.
+`println!(structure:#?)` for pretty-print is also permissible with `Debug`.
+These are different than `dbg!(...)``.
+This will instead print to stderr, and it takes and returns ownership, rather than borrowing.
+
+### Method Syntax
+
+Similar to Python's fucky OOP
+basically moving functions into a struct namespace creates a method, but the
+first param must be a `&self` (mutable or not). This is shorthand for
+`self : &Self` which is shorthand for whatever self actually is in the `impl`.
+
+```
+struct SomeStruct ...
+...
+impl SomeStruct {
+ fn some_function(&self) {...}
+}
+```
+
+Automatic referencing and dereferencing - all arrow operators or other
+notions just get wrapped up in a simple dot operator.
+
+In methods `&self` is shorthand for `self : &Self`.
+In the receiver type, you can do any of:
+
+- an immutable borrow (reading)
+- a mutable borrow (mutating)
+- or taking ownership (consuming)
+
+Taking ownership is rare and more for a special circumstance of preventing the method caller from using the original structure afterward.
+
+A rust convention for getters is to simply use the field name.
+This makes it read-only and provides a space for manipulation before returning the private value.
+
+_automatic referencing and dereferencing_ is possible because the receiver type is explicit.
+(I.e. there is no `->` operator like in C++, only `.`.)
+
+All methods are associated functions.
+An associated function without a `self` is like a static/class method.
+You use `::` on the type to invoke it.
+
+Specifying no self parameter in an `impl` block, like Python creates a sort of
+static method on the structure. (Rust uses the word namespace for both this,
+accessed by ImplName:: and for namespaces proper from modules.)
+
+## 6 Enums and Pattern Matching
+
+Enums can be like C-style enums, but they can be more like Java record types.
+You can have individual, static instantiations/variants imbued with different data.
+
+Variants' data can even be of different types.
+These can even be structs or other enums.
+```Rust
+pub enum Thing {
+ Variant1,
+ Variant2{named_field: i32},
+ Variant3(i32)
+
+}
+```
+
+Enums can have methods.
+Enums can be generic.
+
+`Option` is how the concept of `null` is implemented.
+`None` is the equivalent variant.
+
+### The Match Control Flow Construct
+
+In `match` expressions, enums support value binding.
+Matches are exhaustive.
+The catch-all (default) case just uses a variable rather than a value as the match arm.
+Using `_` is the same, but the compiler will not issue a warning if the value is not used.
+
+To do nothing with a branch, use the unit value.
+`_ => ()`
+
+### Concise Control Flow with `if let`
+
+`if let` is basically a degenerate form of a match.
+It avoids some boilerplate for contriving an equivalent match expression.
+
+You match on one variant and may perform variable binding.
+
+An `else` in an `if let` is equivalent to a `_` in a match block.
+
+## 7 Managing Growing Projects
+
+In growth order,
+Modules -> Files -> Crates -> Packages -> Workspaces
+
+Crates are a rust construct, while packages are a cargo construct.
+Workspaces are a development time grouping of interrelated packages that evolve together.
+
+Packages must have at least one crate.
+Only one can be a library crate.
+
+`src/main.rs` and `src/lib.rs` are special names that will be detected as the crate root for Cargo.
+Then the build result will use the name given in the package manifest.
+`src/bin` can have other executable crates.
+
+### Defining Modules to Control Scope and Privacy
+
+Basically `mod` declares a submodule.
+
+`pub` on a module and on its members allows you to use those members in the context where you "include" it with mod.
+Otherwise, it is still visible to sibling and child modules.
+
+### Modules
+
+These introduce namespaces, are related to `crate`s and allow access
+specification. (Rust calls it "Privacy Boundary").
+
+```Rust
+mod some_module {
+ fn some_function(){
+ ...
+ }
+}
+pub some_public_function () {
+ crate::some_module::some_function() // absolute path
+ some_module::some_function() // relative path
+}
+```
+
+For privacy boundaries, modules, structs, funtions, etc are all private. A child item can access its parent's fields (so siblings can access each other) however a parent cannot access its child (nested) private fields.
+
+To make something public, use `pub` before the identifier.
+`super` can be used to access the immediate parent scope.
+
+Structs need a specifier on each field. Enums only need one at the top-level identifier, and all its variants a public by default.
+
+`std::` actually specifies an absolute path to the standard library. It is not specified in [dependencies] however because it "ships with Rust."
+
+There is a top-level crate (with the same semantics as a module) named `crate`. From it, absolute paths to other modules within the crate can be accessed.
+`crate::SomeModule::`
+
+### Use
+
+Bringing in the parent module and referring the target field with the parent's namespace is idiomatic for functions.
+For structs and enums, it is idiomatic to refer to the entire path
+
+`use std::io;` is an example of including packages.
+`use rand::Rng;` is an example of using traits.
+`use std::cmp::Ordering;` for an enumeration
+
+`as` is used in the same way as Python to rename something included.
+`pub use` allows _reexporting_ or making something that is private and nested some levels in the inner scope to be public to the outter/world.
+
+Nested paths work with use.
+
+```Rust
+use std
+use std::io
+use std::cmp
+// OR
+use std::{self,io,cmp} // Self works here too!
+```
+
+#### Glob Operator
+
+This works for including things.
+It is not advised but convenient for writing test code, or for this "prelude pattern."
+
+`use std::collections::*`
+
+#### File Separation
+
+`use ;` with a semi-colon rather than block means loading defs from a file with the same name as the package.
+
+## 8 Common Collections
+
+### Vectors
+
+```Rust
+v : Vec = Vec::new(); // declaration by function
+v = vec![1, 2, 3]; // declaration by macro
+v.push(4)
+let elem : &i32 = &v[2]; // gets reference, good for crashing in error handling
+let elem2 = v.get(3); // gets Option<&T>
+
+Iterating over immutable references, then mutable
+```Rust
+let v = vec![100, 32, 57];
+for i in &v {
+ println!("{}", i);
+}
+
+let mut v = vec![100, 32, 57];
+for i in &mut v {
+ *i += 50;
+}
+```
+
+Indexing with `[]` can cause a panic.
+`.get()` returns an `Option`.
+
+You can iterate over a vector mutably or immutably.
+Regardless, you cannot mutate the vector reference itself at that point.
+
+Wrapping different types in enum variants lets you make a vector of one enum type.
+Then you essentially have a vector of different types.
+
+### Strings
+
+A string slice is `str`.
+Usually it is borrowed as `&str`.
+The data of the string is stored elsewhere.
+
+String literals are stored in the program binary.
+They are one form of string slices.
+
+Concatenate with `+`, `format!()`, `.push_str()`, and for single chars, `.push()`.
+
+`+` looks weird, because the first argument is the `String` itself (consumes).
+The second is an `&str`.
+
+When adding multiple, it looks weird, so `format!()` is a good idea.
+
+Indexing into string slices requires a range.
+`string[0..2]`
+This is because indexing could represent bytes, characters, or graphemes.
+This is dangerous though, and could cause a panic at runtime.
+`.chars()` and `.bytes()` are useful methods for iteration.
+
+`.split_whitespace()` is a solid method.
+
+### HashMaps
+
+HashMaps are not in the prelude for the core language, but they can be included
+from the standard library. They also cover the idea of dictionaries/associative
+arrays in Rust.
+```Rust
+use std::collections::HashMap;
+```
+
+One way to generate a HashMap is to create iterators from vectors with `.to_iter()` and then calling `.zip(...)` to create tuple pairs, and finally `.collect()` to return to an annotated `HashMap<_,_>`
+
+`.get()` returns an `Option` as usual.
+
+`.insert()` for new values or for **overridding**
+
+`.entry()` returns an Entry, from which `or_insert()` may be called to
+conditionally insert (only new values), and a ref to the value is returned.
+
+`.split_whitespace()`
+
+There's a sort of "structured binding" for key-value pairs.
+
+```Rust
+for (key, value) in &scores {
+ println!("{}: {}", key, value);
+}
+```
+
+HashMaps may either own their keys and values, or they may have references to them.
+`entry(...).or_insert()` is a decently powerful idiom for HashMaps.
+
+## 9 Error Handling
+
+Functions, many from the standard library, return a `Result` enumeration. These
+are generic and specialized for different modules, like `std::io`.
+
+These errors must be handled (???: before end of scope or their lifetimes?).
+`.unwrap()` may be used as a more convenient alternative to a match expression to bind the success value or call `panic!()` on failure.
+
+`Result` also contains an `expect` method to add error handling throughout the code. This is like unwrap but one can provide the message to panic.
+
+The `?` operator allows error propagation by either returning the wrapped `Ok` value or by returning the entire wrapping of the `Err` value. This uses a `from()` function to convert the returned `Err` to the calling functions return `Err`.
+
+These can be chained as in `File::open("hello.txt")?.read_to_string(&mut s)?;`
+
+`std::ops::Try` is the trait behind `Option` and `Result`.
+
+`fn main() -> Result<(), Box>` is main's other valid return type.
+
+### Result
+
+`Result`
+`unwrap_or_else()` allows a closure for not sunny cases.
+`unwrap()` may simply panic.
+`expect()` is similar but you provide a message.
+
+`?` is the error propagation operator.
+The function must have a `Result` return type.
+The operator also adds a `From` implementation to the error to convert it to the return type.
+
+This may also be used with `Option` where the early return is `None`. These cannot be mixed and matched with `Result` though.
+Anything that implements `FromResidual` can actually be used.
+
+Main may return `Result<(), Box`. The latter is a trait object, but that is not explained here.
+Main may return anything that implements `std::process::Termination`.
+That gives a `report` function that returns an `ExitCode`.
+
+Panic is good for tests, prototypes, or examples.
+It is also good when the caller has no way of course correction. For example, only having bad input to supply to a function. This is a contract violation.
+
+Basically use Result if you can recover.
+
+### Panic!
+
+The `panic!("Message");` macro causes Rust to either unwind the stack and exit
+or to abort and leave the OS to clean up the memory.
+
+To allow aborting, in Cargo.toml append to the appropriate profile.
+```toml
+[profile.release]
+panic = 'abort'
+```
+`RUST_BACKTRACE` is an environment variable which if set to 1 (or further to
+'FULL') will give backtraces at panicking.
+
+## 10 Generics, Types, Traits, and Lifetimes
+
+### Generics Data Types
+
+Use generics when you find that your code only differs by types (think a payload sender generic over two different parts of an application with different types).
+
+Also, use generics if you are expressing logic of how some types relate to each other without using the type details. Say, collections.
+
+Traits may be used as basically concepts/constraints, called **trait bounds**.
+``
+
+Type parameters may be applied to structs.
+
+```rust
+struct Point{
+ x: X,
+ y: Y,
+}
+```
+
+Type parameters may be added to implementations.
+`impl Something`
+
+Specifying the type parameter the first time ties it to the second specification. This lets the compiler know that this isn't a simple implementation for a concrete type T.
+I.e.
+This disambiguates specialization of concrete types
+`impl Something`
+
+At the same time, methods within the impl can have their own separate type parameter.
+
+```rust
+ fn mixup(other: Point) -> Point {
+ Point {
+ x: self.x,
+ y: other.y
+ }
+ }
+```
+
+Enums may be generic. `Option ` has one parameter and `Result` has two.
+
+Monomorphization is Rust's name for type erasure or name mangling.
+
+
+### Traits: Defining Shared Behavior
+
+They are similar to interfaces.
+
+Traits are functionality shareable with other types.
+
+_Trait definitions are a way to group method signatures together to define a set of behaviors necessary to accomplish some purpose._
+
+The _orphan rule_ as part of _coherence_ means to implement a trait on a type, the trait or the type must be local.
+
+Traits may provide default implementations in their definition.
+
+This lends to the template method pattern.
+A default implementation may call other methods that have no default.
+Thus only those need to be implemented to give the higher level method.
+
+An overriding trait method cannot call the default method.
+
+
+`impl Trait` syntax is basically taking a trait as a function parameter.
+It is syntactic sugar for `trait bound syntax` which is the same but shows the trait as a type parameter.
+
+Compare these. The latter restricts types to be the same.
+`pub fn notify(item1: &impl Summary, item2: &impl Summary) {`
+And
+`pub fn notify(item1: &T, item2: &T) {`
+
+Multiple trait bounds can be expressed with `+`.
+
+Where clauses are nice.
+
+You can return an impl Trait.
+The caller will only see the trait object.
+
+_Blanket implementation_ is implementing a trait on anything that implements another trait.
+
+```rust
+impl ToString for T {
+ // --snip--
+}
+```
+
+### Lifetimes
+
+Lifetime parameters only make sense on references.
+
+It seems the generic lifetime parameters just link formal parameters with the return type.
+These are _input lifetimes_ and _output lifetime_ for functions.
+
+There are _lifetime elision rules_ that are not quite full lifetime inference.
+
+1. Every input parameter gets an input lifetime.
+2. If there is only one input lifetime, it is assigned to the output lifetime. (Having an output lifetime unrelated to input doesn't make sense, because independently created references would become dangling)
+3. If `self` is present, it's lifetime is assigned to the output lifetime (makes methods cleaner often).
+
+## 11 Testing
+
+Using _attributes_ enables unit (and integration) tests. These are the #[]
+above some definitions.
+```Rust
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn it_works() {
+ assert_eq!(2 + 2, 4);
+ }
+}
+```
+`cargo test` can be used to build the test module and run all unit tests in
+separate threads.
+
+`assert_eq!()`, `assert_ne!()`, `assert!()`, are useful macros for unit tests. The
+first two provide a bit more detail to cargo by default.
+
+Any string after the arguments is passed to `format!()` for more detailed.
+`#[should_panic]` can be attributed after a `#[test]` and can even be made to
+match on specific panic messages with a parameter.
+```Rust
+#[test]
+#[should_panic(expected = "some substring")]
+```
+
+`Result` can also be returned by tests (so, Ok(value) for success or
+Err(message) for failure. This allows the `?` to be used.
+
+`#[ignored]` is useful.
+
+`#[cfg(test)]` is on the module.
+`#[test]` is on the function.
+
+`assert!()`, `assert_eq!()`, and `assert_ne!()` macros are available.
+
+The latter two require their operands to have implemented both `PartialEq` and `Debug` for comparison and printing respectively.
+
+`#[should_panic]` and `#[should_panic, expected="..."]` are useful.
+
+Tests can also not be based on panicking.
+Then they return `Result` (e.g. `Result<(), String>`).
+To check for an `Err` variant, use `assert!(value.is_err())`.
+
+Tests run in parallel by default.
+This means if a test shares resources like a file, either copies of resources must be made, or tests must be run serially, or I guess some synchronization could be done.
+
+Flags can be passed to: show success output, filter by name (including test module name), and run ignored tests.
+
+`#[ignore]` goes after the test macro.
+
+### Unit Tests
+`#[cfg(test)]` means to only compile the module when the configuration
+attribute includes the test parameter (this is provided by `cargo test`).
+
+### Integration Tests
+For Cargo under `tests/*.rs` all files will be compiled as separate test crates
+; however, source files under subfolders will not be (so common code may be
+extracted).
+
+Modules here do not need the configuration attribute, since the folder path
+implies compilation specifically for testing.
+
+**Binary crates do not have integration tests, only library crates.**
+
+Unit test convention is to have the `#[#cfg(test)]` module in the source file alongside the code. This macro will only have the test code built with `cargo test`. This makes `use super::*;` common.
+
+Integration tests are specifically for the public API and use a `tests/` directory.
+Each file is a separate crate representing a separate integration.
+`cargo test --test ` will target only that integration.
+
+Subdirectories under `tests/` do not get handled as files directly under it do. This may be used to provide common code to share between integration tests.
+
+Integration tests are only for library crates `src/lib.rs`. However, a binary crate that factors out its functionality may then use them.
+
+### Automated Tests
+`cargo test -- --test-threads=1` can be used to run tests serially (no
+parallelism).
+`cargo test ` will match test functions names on a pattern. Test
+modules become a part of this pattern.
+`cargo test -- --ignored` runs the ignored tests only.
+
+## 12 Command Line Program
+
+The configuration structure and run function are broken out into library code.
+The run function returns a `Result<(), Box>` which can be propagated.
+That is handled with a process exit code in main.
+
+Environment variables are accessed with `env::var`.
+CLI arguments are accessed with `env::args()`.
+It also uses `std::process` for exit codes.
+
+`std::env::var`
+Printing to standard error may be done with `eprintln!()`.
+
+## 13 Functional Features
+
+### Closures
+
+Closures are basically lambdas.
+`let foo = || x + 2;`
+The syntax can be annotated or pretty reduced.
+Closures pass arguments in the same three ways as functions.
+Explicitly taking ownership (moving/capturing) can be done with `move`.
+
+Functions that take closures may have their parameters trait bound.
+There are three `Fn` traits.
+`FnOnce` means the closure gives back ownership of something it captured.
+The means it cannot be called again.
+`FnMut` mutates something it captures.
+It can be called more than once.
+`Fn` does neither, so it can be called more than once and concurrently.
+
+### Iterators
+
+Iterators are used for functional programming style and allow the abstraction
+of often more mundane iteration tasks (such as on CLI arguments).
+
+_zero-cost abstraction_ coined by Stroustrup.
+This sort of means that lower-level code that is hand-written is subject to
+inoptimization and higher-level abstractions may be more optimized by the
+compiler (nothing is lost by using higher-level abstractions).
+
+The iterator trait is pretty simple.
+It has an associated type though.
+That has its own syntax.
+`iter()`, `iter_mut()`, `into_iter()` provide the three forms of getting values. The first is an immutable reference and the last is ownership.
+
+There are _consuming adapters_ like `.sum()` and `.collect()`.
+These use up the iterator and produce a result based on all the items.
+
+There are _iterator adapters_ which produce a new iterator by changing the original.
+An example of this is `.map()` which takes a closure, applied for each item.
+
+Then there is a good demonstration of improving the handling of `env::args` (an iterator) by directly using that rather than collecting it into a `vec`.
+
+Also there is an example of, instead of declaring a temporary buffer, looping through lines, and filtering by assigning to the buffer, a simple iterator adapter _.filter()_ is used.
+This shows that **iterators are basically loops as objects** which can have operations applied to them.
+
+## 14 Cargo
+
+crates.io
+Existing repos can be easily translated to cargo repos.
+
+`cargo new ` or `cargo new --lib `
+
+In the package...
+cargo build
+cargo build --release
+cargo run
+cargo check
+cargo update
+cargo doc --open # builds and presents all dependency docs
+
+Specifying dependencies uses SemVer.
+```
+[dependencies]
+a_pkg = "3.4.1"
+```
+A bare version number is shorthand for "^3.4.1" which really matches any
+version that is API-compatible (so, up to the next minor release).
+
+### Locking
+
+Cargo.lock contains version numbers of dependencies where the last stable build
+was made. These will not update unless `cargo update` is run.
+
+Even with an update, the dependency will not roll to the next minor release
+unless the Cargo.toml file is actually changed.
+
+### Crates
+
+Packages (the source repo started by Cargo) can either contain (or produce, in
+a sense) either binary crates or a single library crate.
+
+#### Implicit Crate
+
+There is a top-level crate (with the same semantics as a module) named `crate`.
+From it, absolute paths to other modules within the crate can be accessed.
+`crate::SomeModule::`
+
+#### Automated Tests
+
+`cargo test -- --test-threads=1` can be used to run tests serially (no
+parallelism).
+`cargo test ` will match test functions names on a pattern. Test
+modules become a part of this pattern.
+`cargo test -- --ignored` runs the ignored tests only.
+
+### Release profiles
+
+These are different configuration options in the TOML file for different kinds
+of releases of the software.
+
+`[profile.dev]`, `[profile.release]`, etc.
+
+### Packaging
+
+The `[package]` tag is used. Under this is specified common data with which to
+upload a software package to crates.io.
+
+`cargo login` uses `~/.cargo/credentials` to store the private API token.
+
+???: Is there a way to spin up a common registry for Rust crates? There must
+be.
+
+`cargo yank --vers x.y.z` locks prevents future projects from using your software version
+within their Cargo.lock file. It does not delete code.
+`cargo yank --vers x.y.z --undo` undoes this (unsurprisingly).
+
+### Workspaces
+
+a set of packages that share the same `Cargo.lock` and output directory.
+```
+├── Cargo.lock
+├── Cargo.toml
+├── add-one
+│ ├── Cargo.toml
+│ └── src
+│ └── lib.rs
+├── adder
+│ ├── Cargo.toml
+│ └── src
+│ └── main.rs
+└── target
+```
+Different versions of dependencies within different TOML files will be resolved
+and will be decided within the top-level Cargo.lock file.
+
+Dependency paths must be added in one crate's toml file to another crate in
+order to use that crate. `use` statements must still be used.
+
+`cargo run -p ` allows one to run a specific crate in the workspace.
+`cargo test -p `
+
+`cargo install` can be used to additionally install extensions to Cargo itself,
+so called `cargo-`. These can then be run as `cargo `.
+
+**Cargo packages are intended for developers, not system operation.** (apparently)
+
+## 15 Smart Pointers
+
+Smart pointers own their data, unlike references.
+
+Smart pointers are structs that implement `Deref` and `Drop`
+
+- `String` and `Vec`
+- `Box` - heap allocation
+- `Rc` - reference counting
+- `Ref`, `RefMut`, `RefCell` enforce borrowing rules at runtime rather than at compile time.
+
+Standard pointers in Rust are like references but can own their data.
+
+_interior mutability pattern_
+
+`Box` is a for simple heap allocation.
+It is useful in, say, creating _recursive types_.
+
+A box in the standard library is basically a tuple of one element.
+This element implements `Deref`, so that the `*` operator may be called on it.
+This operator first gets a reference to the inner element (in the tuple).
+This would seem backwards.
+_Then_ it de-references that to get and return the inner value.
+
+### Implicit Deref Coercions
+
+_Deref coercion_ is similar to automatic unboxing.
+It can do more though (or auto-unboxing is one type).
+
+Passing references or pointers (such as `Box<>` values) may be automatically, implicitly dereferenced.
+It seems harry but makes the code look cleaner.
+
+For example, `Box` can be passed to `&str` and coerced to that type.
+
+```rust
+fn main() {
+ let m = MyBox::new(String::from("Rust"));
+ hello(&m);
+}
+```
+
+Without deref coercion, you would need to write:
+
+```rust
+fn main() {
+ let m = MyBox::new(String::from("Rust"));
+ hello(&(*m)[..]);
+}
+```
+
+There is also `DerefMut`.
+Per the book,
+
+> Rust does deref coercion when it finds types and trait implementations in three cases:
+>
+> - From `&T` to `&U` when `T: Deref`
+> - From `&mut T` to `&mut U` when `T: DerefMut`
+> - From `&mut T` to `&U` when `T: Deref`
+
+### Drop
+
+Drop is the other trait included in the prelude to implement for a smart pointer.
+This executes right as the pointer goes out of scope.
+
+```Rust
+
+impl Drop for CustomSmartPointer {
+ fn drop(&mut self) { ... }}
+```
+
+It cannot be called manually if destruction is desired before end of scope.
+Instead, `std::mem::drop()` must be called.
+(Otherwise this would cause a _double free error_).
+
+### Reference Counting
+
+`std::rc::Rc` is **not** brought into scope by the prelude.
+This allows multiple references to the same object (which will not be destructed until the final reference goes out of scope).
+
+Declare a `Rc` rather than `Box` if ownership must be shared.
+`Rc` is for single-threaded applications only.
+`Rc` only allows immutable borrows.
+
+For example, two pointers in two different objects point to the same data.
+`Rc::clone(&some_rc)` is convention over `some_rc.clone()` because it is unlike other cloning methods.
+Rather than make a deep-copy, it just bumps the reference count.
+
+The count may be gotten with `Rc::strong_count(&rc)`.
+
+### Interior Mutability
+
+This can be done with `RefCel`.
+
+`RefCell<>` moves borrow checking to runtime.
+This is useful for example for creating mock objects which must conform to immutable signatures but hold mutable data.
+(See the explanation below.)
+
+`Cell<>` does this for copying data and `Mutex<>` for thread-safe scenarios.
+
+It's weird because it looks like it defeats the purpose of immutability.
+I think the idea is that the `RefCel` itself, the pointer, is constant but can point to mutable data.
+This seems to be the canonical construct in rust with this power, called _interior mutability_.
+
+Violating the borrow checker's rules with this will cause a runtime panic, not a compilation error.
+
+The example is a long one, showing mocking for testing.
+Instead of state verification, it shows that the methods called on the collaborator objects by the method under test can be wired to verify the object under test.
+
+This can be chained with `Rc` to get a shared pointer to mutable data, i.e. `Rc>`.
+Calling `.borrow()` returns an immutable pointer, specifically a `Ref`.
+Calling `.borrow_mut()` returns a mutable pointer, specifically a `RefMut`.
+
+`Mutex` is the thread-safe version of `RefCel`.
+
+Using `Rc` can create reference cycles, like a cycle in a linked list.
+When the two original pointers to the two data are dropped, the internal linkages between them remain (accounted for in the reference counting).
+This means the memory would never be unallocated.
+
+A way to avoid this is with `Weak`, which is a type related to `Rc`.
+
+These are almost like symlinks v. hard links.
+They increase the `.weak_count()` but not `.strong_count()`.
+So if a weak link remains but the strong count hits zero, the memory is still unallocated.
+
+It is the same otherwise, but semantically it doesn't express ownership.
+
+For example, in a tree, the parent has an `Rc` to children nodes.
+The children nodes have a `Weak` to their parent.
+
+To use a `Weak`, you have to `weak.borrow().upgrade()` and check the `Option`.
+Or `Rc::downgrade(&strong)`
+
+## 16 Fearless Concurrency
+
+`handle : JoinHandle = thread::spawn(|| {})`
+Can `move` captures into the thread.
+`handle.join().unwrap()`
+`thread::sleep(time::Duration::from_secs(1))`
+
+Also, to avoid `move` into threads.
+```
+thread::scope(|s| {
+ s.spawn(|| {
+ println!("Here's a vector: {v:?}");
+ });
+ });
+```
+
+### Messaging Passing
+
+`use std::sync::mpsc`
+`let (rx, tx) = mpsc::channel();`
+
+You can give a transmitter to another thread.
+Threads must own their transmitter (or I guess receiver).
+
+Sending data moves it to the other thread.
+Sending returns a `Result` so you can check if the channel already closed.
+
+You can call `recv` on the receiver, which blocks but will return a `Result`.
+An error will be returned when thecloses.
+
+`try_recv` will return immediately, either with `Some(T)` or an `Err` if there are no messages.
+
+You can also clone transmitters, fulfilling the name _multiple producer single consumer (MPSC)_.
+So, multiple threads can have their own producer/transmitter.
+
+### Shared Memory
+
+Messaging passing is the equivalent of a single owner of data.
+Shared memory is like having multiple owners.
+
+This can be done with a `std::sync::Mutex`.
+A good metaphor is acquiring a microphone in a panel in order to speak among a crowd.
+
+`Mutex::new(...)` returns a `Mutex`.
+Calling `.lock()` will block and return a `LockResult`.
+It will be an `Err` variant if another thread with the lock panicked.
+Otherwise it will be a `MutexGuard`.
+That is a smart pointer which can be dereferenced to access/modify the value you care about.
+It will also unlock the mutex on its `Drop` implementation.
+
+The problem with Mutexes (Mutices?) is that you need a shared reference among threads to make them useful.
+Thus you must wrap them into a reference counting construct like `Rc`.
+`Rc` is not thread-safe, however, but `Arc` is.
+This is an _atomic_ `Rc`.
+
+There are other atomic primitives.
+
+Using `Arc>` is analgous to `Rc>` in single-threaded world.
+This is because `Mutex`, like `RefCel` actually provides _interior mutability_.
+
+Mutexes can lead to _deadlocks_.
+
+### Send and Sync
+
+Both `std::marker::{Send,Sync}` are "marker traits".
+All they do is mark the thing that implements it.
+If something implements `Send`, it is safe to `move` to another thread.
+`Rc` cannot implement this, for example, because sending a `.clone()` could have logical rammifications (both clones update the same count).
+
+If it implements `Sync`, immutable references to it can be sent to another thread.
+(If `&T: Send` then `T: Sync`.)
+
+Implementing these yourself is part of unsafe rust.
+A type built only of types that have these markers will then have these markers themselves.
+
+## 17 Fundamentals of Asynchronous Programming: Async, Await, Futures, and Streams
+
+There is a trait `Future`, which is the backbone of asynchronous Rust.
+
+`async` marks functions as asynchronous. They can be interrupted and resumed.
+Calling `.await` on a future is a time (an "await point") for the `async` function to either continue immediately or be interrupted.
+(This lets the async runtime know it is a good time.)
+This is because a future is expected to take some amount of time, so it may make sense to `.await` it.
+
+`async` functions actually compile to regular functions that return an anonymous implementation of `Future`.
+In other words,
+```
+async fn foo() -> bool {
+ true
+}
+```
+becomes
+```
+fn foo() -> impl Future