<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Chapters for Building a Rust CLI Password Generator on AI VOID</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/</link><description>Recent content in Chapters for Building a Rust CLI Password Generator on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 01 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/rust-password-generator-guide/index.xml" rel="self" type="application/rss+xml"/><item><title>Chapter 1: Setting Up Rust and Your Project</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-01-setup-rust-and-project/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-01-setup-rust-and-project/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;In this foundational chapter, you will set up your development environment by installing Rust and its accompanying package manager, Cargo. You will then initialize a new Rust project, which will serve as the base for our password generator CLI application. Getting this right is crucial for a smooth development process.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Rust:&lt;/strong&gt; A modern systems programming language known for its speed, memory safety, and parallelism. It&amp;rsquo;s an excellent choice for CLI tools due to its performance and the ability to compile to a single, self-contained binary.&lt;/p&gt;</description></item><item><title>Chapter 10: Deployment with `cargo install`</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-10-deployment-with-cargo-install/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-10-deployment-with-cargo-install/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;Our password generator is now complete with core features, robust error handling, logging, and unit tests. The final step to making it a production-ready tool is to properly package and deploy it so that users (including yourself) can easily install and run it from anywhere on their system. This chapter will cover building a release binary and deploying it using &lt;code&gt;cargo install&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Release Build:&lt;/strong&gt; When developing, Rust compiles code in &amp;ldquo;debug mode&amp;rdquo; by default, which includes debugging information and fewer optimizations, making compilation faster. For deployment, we use &amp;ldquo;release mode&amp;rdquo; which optimizes the code for performance and size, resulting in a production-ready executable.&lt;/p&gt;</description></item><item><title>Chapter 2: Defining CLI Flags with Clap</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-02-define-cli-flags/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-02-define-cli-flags/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;This chapter focuses on defining the command-line interface (CLI) for our password generator. We&amp;rsquo;ll use the &lt;code&gt;clap&lt;/code&gt; crate to specify flags and options that allow users to customize their generated passwords, such as length, inclusion of numbers, symbols, and uppercase/lowercase letters.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Command-Line Argument Parsing:&lt;/strong&gt; CLI tools rely on arguments and flags provided by the user to determine their behavior. For example, a user might type &lt;code&gt;rpassword-gen --length 16 --numbers&lt;/code&gt; to generate a 16-character password including numbers. Parsing these arguments correctly is crucial.&lt;/p&gt;</description></item><item><title>Chapter 3: Core Password Generation Logic</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-03-core-password-logic/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-03-core-password-logic/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;Now that we can parse command-line arguments, it&amp;rsquo;s time to build the core engine of our password generator: the logic for selecting characters and randomly assembling them into a password. This chapter will focus on creating a pool of possible characters based on user input and then picking random characters from that pool.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Random Number Generation (RNG):&lt;/strong&gt; For security-critical applications like password generators, it&amp;rsquo;s vital to use a cryptographically secure pseudo-random number generator (CSPRNG). This ensures that the generated sequences are unpredictable and cannot be easily guessed or reproduced. The &lt;code&gt;rand&lt;/code&gt; crate in Rust provides this capability.&lt;/p&gt;</description></item><item><title>Chapter 4: Refining Character Set Management</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-04-implementing-character-sets/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-04-implementing-character-sets/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;While our current character set management works, it can become cumbersome as we add more options (e.g., excluding ambiguous characters). This chapter will refine our character set logic by introducing a more structured approach, making it easier to manage which characters are included or excluded. We&amp;rsquo;ll also ensure a sensible default where at least &lt;em&gt;some&lt;/em&gt; character types are always selected.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Character Enums/Structs:&lt;/strong&gt; Instead of simply using boolean flags and &lt;code&gt;String::push_str&lt;/code&gt;, we can represent character sets more abstractly. This might involve creating an enum for character types or a helper struct that encapsulates the character pools and their selection logic. For this chapter, we&amp;rsquo;ll keep it fairly direct but improve the &lt;code&gt;main&lt;/code&gt; function&amp;rsquo;s structure.&lt;/p&gt;</description></item><item><title>Chapter 5: Generating Passwords with Specific Length</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-05-generating-passwords-with-length/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-05-generating-passwords-with-length/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;We have the ability to gather user preferences for character types and a desired password length. In this chapter, we will ensure that our password generation loop correctly produces a password of exactly the &lt;code&gt;length&lt;/code&gt; specified by the user, drawing characters from our carefully constructed character pool. While the previous chapter already introduced this loop, this chapter solidifies its role and ensures its accuracy.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Looping for Length:&lt;/strong&gt; The fundamental approach to generating a password of a specific length is to iterate that many times, picking one random character in each iteration and appending it to our result string.&lt;/p&gt;</description></item><item><title>Chapter 6: Handling Multiple Passwords</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-06-handling-multiple-passwords/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-06-handling-multiple-passwords/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;Many users might want to generate several passwords at once to choose from, or for different accounts. This chapter will extend our CLI tool to accept a &lt;code&gt;--count&lt;/code&gt; flag, allowing users to specify how many passwords they want to generate, and then print each one on a new line.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Iteration for Multiple Outputs:&lt;/strong&gt; Similar to how we iterate for password length, generating multiple passwords involves an outer loop that repeats the entire password generation process a specified number of times.&lt;/p&gt;</description></item><item><title>Chapter 7: Error Handling and User Feedback</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-07-error-handling-and-user-feedback/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-07-error-handling-and-user-feedback/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;A production-ready application doesn&amp;rsquo;t just work when everything goes right; it also handles errors gracefully and provides helpful feedback when things go wrong. In this chapter, we&amp;rsquo;ll refine our error handling, moving from simple &lt;code&gt;eprintln!&lt;/code&gt; and &lt;code&gt;process::exit&lt;/code&gt; to a more structured approach using custom error types. This makes our application more robust and user-friendly.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error Types:&lt;/strong&gt; In Rust, errors are typically represented by types that implement the &lt;code&gt;std::error::Error&lt;/code&gt; trait. Custom error enums, often used with &lt;code&gt;thiserror&lt;/code&gt; (though we&amp;rsquo;ll keep it manual for this guide for simplicity), provide structured ways to define different error conditions.&lt;/p&gt;</description></item><item><title>Chapter 8: Logging and Debug Output</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-08-logging-and-debug-output/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-08-logging-and-debug-output/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;For development, debugging, and understanding how our application behaves in different scenarios, logging is invaluable. This chapter will introduce basic logging capabilities to our password generator using the &lt;code&gt;env_logger&lt;/code&gt; crate, allowing us to output debug information that can be toggled via environment variables without cluttering normal user output.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Logging Frameworks:&lt;/strong&gt; Libraries like &lt;code&gt;log&lt;/code&gt; provide a common interface for logging (e.g., &lt;code&gt;info!&lt;/code&gt;, &lt;code&gt;debug!&lt;/code&gt;, &lt;code&gt;error!&lt;/code&gt;). These are typically paired with a &amp;ldquo;logger backend&amp;rdquo; (like &lt;code&gt;env_logger&lt;/code&gt;) that actually handles how and where those log messages are displayed.&lt;/p&gt;</description></item><item><title>Chapter 9: Basic Unit Testing</title><link>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-09-basic-unit-testing/</link><pubDate>Mon, 01 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/rust-password-generator-guide/chapter-09-basic-unit-testing/</guid><description>&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of This Chapter&lt;/h3&gt;
&lt;p&gt;Ensuring the correctness and reliability of our password generator is paramount. Unit tests allow us to verify that individual components of our application work as expected. In this chapter, we will write basic unit tests for our &lt;code&gt;build_char_pool&lt;/code&gt; function and the &lt;code&gt;generate_single_password&lt;/code&gt; function to catch regressions and validate our logic.&lt;/p&gt;
&lt;h3 id="concepts-explained"&gt;Concepts Explained&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Unit Testing:&lt;/strong&gt; Testing individual units or components of your code (e.g., functions, methods) in isolation to ensure they behave correctly.&lt;/p&gt;</description></item></channel></rss>