Chapter 1: Why Rust?

Welcome to Zero-to-Rust! This first chapter explains why Rust has become one of the most loved programming languages in the world, and why learning it—even as your first language—is a powerful choice for your programming journey.

#1
Most Loved Language (Stack Overflow, 8 years)
70%
Security Bugs Preventable
0
Garbage Collection Pauses
100%
Memory Safety at Compile Time

1.1 The Memory Safety Revolution

For decades, systems programming meant choosing between performance and safety. Languages like C and C++ offered incredible speed and low-level control, but came with a dangerous tradeoff: memory bugs. Buffer overflows, use-after-free, null pointer dereferences, and data races have plagued software development since the beginning.

These aren't just annoying bugs—they're responsible for approximately 70% of security vulnerabilities in major software systems. Microsoft, Google, and Mozilla have all published studies confirming this statistic. The cost of these bugs runs into billions of dollars annually in security breaches, data loss, and developer time.

The Memory Bug Problem

Common memory bugs in traditional systems languages:

Rust changes this equation entirely. It guarantees memory safety at compile time—not through runtime garbage collection (which adds overhead), but through a unique ownership system that the compiler enforces. If your Rust code compiles, it is memory-safe. Period.

The Rust Promise

If your code compiles, you get these guarantees for free:

The compiler catches these bugs before your code ever runs.

1.2 Performance Without Compromise

Rust compiles to native machine code and runs as fast as C or C++. There's no virtual machine, no interpreter, no runtime overhead. When you need every ounce of performance from your hardware, Rust delivers.

How Fast Is Rust?

Language Speed Memory Control Safety
C/C++ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐
Rust ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Go ⭐⭐⭐⭐ ⭐⭐⭐ ⭐⭐⭐⭐
Java ⭐⭐⭐ ⭐⭐ ⭐⭐⭐⭐
Python ⭐⭐⭐⭐

This performance profile makes Rust perfect for demanding applications:

1.3 Zero-Cost Abstractions

In many languages, using high-level abstractions (like iterators, generics, or pattern matching) comes with a performance cost. In Rust, these abstractions compile away to the same efficient machine code you would write by hand. This is called "zero-cost abstraction."

High-Level Rust

let sum: i32 = numbers
    .iter()
    .filter(|x| **x > 0)
    .map(|x| x * 2)
    .sum();

Compiles to Same As

let mut sum = 0;
for x in &numbers {
    if *x > 0 {
        sum += *x * 2;
    }
}

The expressive, readable code on the left produces identical machine code to the manual loop on the right. You don't have to choose between clarity and performance—Rust gives you both.

The Zero-Cost Abstraction Principle

"What you don't use, you don't pay for. And what you do use, you couldn't hand-code any better."

— Bjarne Stroustrup (applied to Rust as well as C++)

Examples of Zero-Cost Abstractions

// Generics - no runtime cost
fn largest<T: PartialOrd>(list: &[T]) -> &T {
    let mut largest = &list[0];
    for item in list {
        if item > largest {
            largest = item;
        }
    }
    largest
}

// Works with any comparable type
let max_int = largest(&[1, 5, 3, 9, 2]);
let max_char = largest(&['a', 'z', 'm']);

The compiler generates specialized code for each type used—no virtual dispatch, no boxing, no overhead.

1.4 Modern Developer Experience

Rust comes with world-class developer tools that make programming a joy:

Tool Purpose Similar To
cargo Build system, package manager, project scaffolding npm, pip, maven (all-in-one)
rustfmt Automatic code formatting prettier, gofmt
clippy Linting and code improvement suggestions eslint, pylint
rust-analyzer IDE integration (completion, navigation, refactoring) TypeScript language server
docs.rs Automatic documentation hosting javadoc, sphinx
crates.io Package registry with 130,000+ libraries npmjs.com, PyPI

The Helpful Compiler

Rust's compiler doesn't just tell you there's an error—it explains exactly what's wrong and often suggests how to fix it:

error[E0382]: borrow of moved value: `s1`
 --> src/main.rs:5:20
  |
2 |     let s1 = String::from("hello");
  |         -- move occurs because `s1` has type `String`
3 |     let s2 = s1;
  |              -- value moved here
4 |
5 |     println!("{}", s1);
  |                    ^^ value borrowed here after move
  |
help: consider cloning the value if you want to use it
  |
3 |     let s2 = s1.clone();
  |                ++++++++
The Compiler is Your Teacher

Many developers initially find Rust's compiler strict. But soon they realize: the compiler is teaching them to write better code. The errors that seem frustrating at first are actually preventing bugs that would be much harder to find later.

1.5 A Brief History of Rust

2006

Graydon Hoare starts Rust as a personal project at Mozilla.

2009

Mozilla begins officially sponsoring the Rust project.

2010

First public announcement of Rust.

2015

Rust 1.0 released. Stability guarantees begin.

2016-2023

Rust wins "Most Loved Language" in Stack Overflow survey every year.

2021

The Rust Foundation is established. AWS, Google, Microsoft, Mozilla, and Huawei join as founding members.

2022

Linux kernel accepts Rust as a second supported language alongside C.

2024

U.S. government recommends Rust for memory-safe systems programming.

1.6 Who Uses Rust?

Rust isn't just for hobbyists—it's used in production by the world's largest technology companies:

Industry Adoption

1.7 Why Zero-to-Rust?

Many programming tutorials recommend starting with Python or JavaScript, then moving to "harder" languages later. We take a different approach. Here's why:

Rust First: The Advantages

Traditional Path

  • Learn loose typing first
  • Ignore memory management
  • Debug runtime errors
  • Unlearn bad habits later

Rust First Path

  • Learn strong typing from start
  • Understand memory deeply
  • Catch errors at compile time
  • Build good habits immediately
Rust Isn't "Harder"—It's Different

When beginners say Rust is "hard," what they usually mean is that Rust makes you think about things other languages hide from you. But these concepts (ownership, borrowing, lifetimes) are real whether or not your language forces you to acknowledge them. By learning them explicitly, you become a better programmer in any language.

What You'll Learn

This course covers everything you need to go from zero to productive Rust developer:

1.8 Chapter Summary

Key Takeaways

1.9 Review Questions

Test Your Understanding

  1. What percentage of security vulnerabilities in major software are caused by memory bugs? How does Rust address this?
  2. Explain the concept of "zero-cost abstractions." Why is this important for systems programming?
  3. What is the role of Rust's compiler in ensuring memory safety? How is this different from garbage collection?
  4. Name three major companies that use Rust in production and describe one use case for each.
  5. Why might learning Rust as a first programming language be advantageous compared to starting with dynamically-typed languages?
  6. What are the five key tools in the Rust ecosystem, and what does each do?

1.10 Looking Ahead

What's Next: Chapter 2 - Getting Started

In the next chapter, you'll set up your Rust development environment and write your first program:

Korea Standardization Infrastructure Mapping

Korea operates a comprehensive standards governance system through inter-ministerial cooperation. National Standards Council (under Prime Minister's Office, per Framework Act on National Standards Article 5) coordinates KATS (Korean Agency for Technology and Standards), MFDS (Ministry of Food and Drug Safety), MOTIE (Ministry of Trade, Industry and Energy), MSIT (Ministry of Science and ICT), MOIS (Ministry of the Interior and Safety), MOE (Ministry of Environment), MOHW (Ministry of Health and Welfare), MND (Ministry of National Defense), MCST (Ministry of Culture, Sports and Tourism), MOFA (Ministry of Foreign Affairs), MOJ (Ministry of Justice), and FSC (Financial Services Commission). Accreditation and Testing: KOLAS (Korea Laboratory Accreditation Scheme) accredits 800+ testing laboratories. KAS (Korea Accreditation System) accredits 50+ certification bodies. KTC (Korea Testing Certification), KTR (Korea Testing & Research Institute), KTL (Korea Testing Laboratory), and KCL (Korea Conformity Laboratories) provide conformance testing. Telecom and Cyber: KCC (Korea Communications Commission), KCA (Korea Communications Agency), TTA (Telecommunications Technology Association), IITP (Institute for Information & Communications Technology Planning & Evaluation), NIPA (National IT Industry Promotion Agency), KISA (Korea Internet & Security Agency), KCMVP (Korea Cryptographic Module Validation Program), NIS (National Intelligence Service), NSR (National Security Research Institute), and NCSC (National Cyber Security Center). National R&D Centers: KIST, ETRI, KAIST, Seoul National University, Yonsei University, Korea University, POSTECH, UNIST, GIST, DGIST, KISTI, KIER, KIMM, KRICT, KFRI, KRIBB. International Standards Cooperation: ISO TC/SC Korean secretariats, IEC TC/SC Korean secretariats, ITU-T Study Group Korean chairs, 3GPP RAN/SA Korean chairs, IEEE 802 Korean chairs, W3C Korea office, OASIS Korea office, IETF Korea cooperation, OECD CSTP, UN ESCAP, APEC SCSC Korean cooperation. Korean Industrial Standards (KS) Catalog: KS X (Information) 25,000+, KS A (Basic) 15,000+, KS B (Machinery) 25,000+, KS C (Electrical) 18,000+, KS D (Metallurgy) 12,000+, KS E (Mining) 5,000+, KS F (Construction) 18,000+, KS H (Food) 8,000+, KS I (Environment) 5,000+, KS J (Biology) 3,000+, KS K (Textile) 15,000+, KS L (Ceramics) 7,000+, KS M (Chemistry) 12,000+, KS P (Medical) 5,000+, KS Q (Quality Mgmt) 4,000+, KS R (Transport) 12,000+, KS S (Service) 3,000+, KS T (Packaging) 4,000+, KS V (Shipbuilding) 5,000+, KS W (Aerospace) 3,000+ — totaling 220,000+ Korean Industrial Standards. Key Acts: Personal Information Protection Act (Act 19234, effective Sept 15, 2024), Electronic Government Act, Electronic Signature Act, Act on Promotion of Information and Communications Network Utilization and Information Protection, Information and Communications Infrastructure Protection Act, Data Industry Act, Public Data Act, AI Framework Act (Act 20212, effective July 2026), Industrial Technology Innovation Promotion Act, Framework Act on Science and Technology — 70+ Korean standardization-related laws.

Korea Digital Transformation Detailed Mapping

Korea operates digital transformation through a comprehensive governance system. Digital Government: Digital Platform Government Committee (established September 2022, under the President)·Ministry of the Interior and Safety Digital Government Bureau·e-Government Support Center·Gov.kr·National Citizen Service·KDIS (Korea Digital Information Society)·NIA (National Information Society Agency)·MOIS (Ministry of the Interior and Safety). K-DNS Infrastructure: Korea Internet & Security Agency (KISA) Korea Internet Center·KISA DNS Root Server·KRNIC (Korea Network Information Center)·BGP Korea·National Cyber Security Center (NCSC)·KCC (Korea Communications Commission)·MSIT (Ministry of Science and ICT)·NIA·NIPA. Korean Cloud Infrastructure: KT Cloud·NAVER Cloud (NCloud)·Samsung SDS Cloud·LG U+ Cloud·NHN Cloud·Kakao Enterprise Cloud·SK Telecom Cloud·KISA Cloud Security Assurance Program (CSAP)·KCMVP-validated cloud·ISMS-P (Information Security & Personal Information Management System). Korean Security Certifications: KISA ISMS-P certification·KCMVP (Korean Cryptographic Module Validation Program)·NIS (National Intelligence Service) "National Cryptographic Technology Operation Standards"·NCSC "National Cyber Security Strategy 2024-2028"·CC (Common Criteria) Korean evaluation bodies·EAL4·EAL5·KS X ISO/IEC 15408·19790·24759 Korean Profile. Korean Data Standards: NIA AI Hub·National Data Standardization Committee·Statistics Korea (KOSTAT)·MyData 4 Designated Combination Specialists (Samsung SDS, KICI, KOSTAT, KFTC)·National Institute of Korean Language·National Law Information Center·National Spatial Information Platform·National Spatial Data Center·Korean Spatial Information Standards. Finance and Fintech Standards: FSC (Financial Services Commission)·FSS (Financial Supervisory Service)·FIU (Financial Intelligence Unit)·BOK (Bank of Korea)·FSEC (Financial Security Institute)·KFTC (Korea Financial Telecommunications)·KSD (Korea Securities Depository)·KRX (Korea Exchange) 8-agency cooperation. 5G/6G Communications Infrastructure: 5G subscribers 35 million (2024)·5G base stations 350,000·6G commercialization target 2028·5G dedicated networks 16 operators·6G Acceleration Council (MSIT, 2024). K-Content: KOCCA (Korea Creative Content Agency)·MCST (Ministry of Culture, Sports and Tourism)·KCA (Korea Communications Agency)·Korea Culture Information Service Agency·Korean Film Archive·Korea Publishing Industry Promotion Agency. Data 3 Acts (Personal Information Protection Act·Credit Information Act·Telecommunications Network Act, 2020 enforcement)·Data Industry Act (2021)·Public Data Act (2013)·AI Framework Act (2026)·Digital Platform Government Framework Act (2024 proposed) — Korea digital transformation core legislation.