Rust for Kids
Author: Miquel Cabot (miquel@cabot.dev)
Rust for Kids is an educational project designed to introduce the Rust programming language to young learners in a fun, accessible, and interactive way. Using a combination of mdBook and Reveal.js, this book blends storytelling, visual slides, and hands-on coding examples to teach core programming concepts through Rust. Whether you're a teacher, parent, or curious kid, this resource aims to make systems programming approachable and enjoyable. One small Rustacean step at a time!
Read the Book
We suggest the online version for general use, but cloning, installing, and building this book offline is a great option on-the-go.
Hosted Online
The latest version is hosted at: https://cabot.dev/rust4kids
Build Offline
You need to install rust before you can continue.
In order to make
your life easy 😉, there is a set of tasks that use cargo make
.
With cargo make
installed, you can list all tasks included to facilitate further installation, building, serving, formatting, and more with:
# Run from the top-level working dir of this repo
makers --list-all-steps
The tasks should be self-explanatory, if they are not - please file an issue to help us make them better.
License
All materials found within this repository are licensed under Mozilla Public License Version 2.0 - See the License for details.
Preface
Dedicated to my son, Joan, and my daughter, Aina, who inspire me every day to make learning fun and exciting. 💖
👋 Welcome to Rust for Kids
Have you ever wondered how video games, robots, or websites are built? Or how your computer understands what to do when you click a button or type a word?
In this book, you'll start from the very beginning: learning how computers store files, follow instructions, and even speak in binary! Then we'll dive into Rust, a fun, powerful programming language that's used in everything from spaceships to video games.
This book is designed especially for kids, teens, parents, and curious beginners. No experience needed. Just bring your imagination and a little curiosity. 🧠✨
🦀 Why Rust?
Rust is different from many other programming languages. Here's why we love it:
- ✅ Fast and efficient: used in real-world systems like Firefox and Linux.
- 🧠 Safe by design: it helps prevent bugs before they happen!
- ❤️ Friendly: it has a great community and excellent documentation.
- 🧰 Modern tooling: with tools like
cargo
, building projects is easy and fun. - 🌍 Versatile: you can build websites, games, robots, or even blockchains.
Plus... it has a super cute mascot: Ferris the Crab! 🦀
📚 Recommended Rust Book
- The Rust Programming Language, by Steve Klabnik and Carol Nichols Read online
This is the official book for grown-ups who want to master Rust. We recommend it for parents, teachers, or older kids who want to go deeper after this book.
📘 Other Great Programming Books
These books are for older readers who want to become better software engineers over time:
- Code Complete: A Practical Handbook of Software Construction, Second Edition, Steve McConnell
- The Pragmatic Programmer: Your Journey to Mastery, David Thomas i Andrew Hunt
- Clean Code: A Handbook of Agile Software Craftsmanship, Robert C. Martin
🚀 Ready?
By the end of this journey, you'll know how to:
- Navigate your computer's filesystem like a pro
- Count in binary like a robot 🤖
- Write your own programs using Rust
- Build small games and command-line tools
- Think like a real systems programmer
Let's go! One small Rustacean step at a time... 🦀👣
Meet the Computer
Before we start coding in Rust, let's take a little tour of the magical machine we'll be working with: 🧠 the computer!
In this chapter, you'll learn:
- 🧱 What a computer is made of. Including its brain (CPU), memory (RAM), and how it stores stuff (storage).
- 🗂️ How computers organize information using files and folders.
- 💻 How to use the terminal. A secret door where you type commands and talk to your computer like a real programmer.
- 🔢 How computers think in binary. Just 1s and 0s, like tiny light switches turning on and off.
By the end of this section, you'll have x-ray vision for how your device works and be ready to write your very first lines of code. Let's peek inside the machine! 👀⚙️
The Computer's Brain (Hardware vs Software)
🧠 What's Inside a Computer?
A computer might look like just a box with a screen and keyboard... But inside, it's full of tiny parts that work together to follow instructions, store data, and show you cool stuff!
🧱 Two Main Parts
Every computer is made of two main ideas:
💾 Hardware
These are the physical parts you can touch.
- 🧠 CPU (Central Processing Unit): The brain of the computer. It thinks really fast.
- 🧮 RAM (Memory): Temporary space to remember things while working.
- 🗃️ Storage (like a hard drive): Where files and programs live when you're not using them.
- 🖱️ Input devices: Keyboard, mouse, microphone: things you use to talk to the computer.
- 🖥️ Output devices: Monitor, speakers, printer: the computer's way to talk back!
📜 Software
Software is made of code: instructions written by humans.
It tells the hardware what to do! Like:
- "Draw a picture"
- "Play a sound"
- "Open this folder"
- "Run this game"
Rust is a language used to write this code. 🦀
🔁 How It All Works Together
Imagine:
- You press a key (📥 input)
- The keyboard sends a message to the CPU (🧠)
- The CPU checks the program (📜 software)
- The screen shows a letter (📤 output)
It happens in a blink, but it's all hardware and software working together!
🧪 Try This!
Think of another machine (like a microwave or robot toy). Can you name its input, output, memory, and "brain"?
(Write it down or discuss with a friend!)
✅ Summary
- A computer has hardware (the parts) and software (the code).
- The CPU is the brain. It works with memory and storage to follow instructions.
- You give the computer commands (input) and it gives you results (output).
- With Rust, you'll soon write your own software to control this amazing machine!
Let's explore the filesystem next!
The File System and the Command Line
🗂️ What Are Files and Folders?
Your computer is like a big library 📚. Inside it are:
- Files 📄 → documents, pictures, music, code, and more.
- Folders 📁 → containers to help organize your files.
You can put files inside folders, and folders inside other folders. Just like boxes inside boxes!
🖥️ Different Operating Systems
There are three main types of operating systems (OS):
- 🐧 Linux: free, open-source, used on many servers and by programmers.
- 🍎 macOS: used on Apple computers.
- 🪟 Windows: very common in schools and offices.
They all do the same basic things, but the way you use the terminal or navigate folders might look a little different.
📌 This Book Uses: Linux & macOS
To keep things simple, this book focuses on:
- ✅ Linux (like Ubuntu or Debian)
- ✅ macOS (on a MacBook or iMac)
If you're using Windows, don't worry! You can still follow along.
💡 Windows Users: Use WSL
To get a Linux-like terminal on Windows, install:
🔧 WSL (Windows Subsystem for Linux) It lets you run Linux commands inside Windows. You can install it by following this guide: 👉 https://learn.microsoft.com/en-us/windows/wsl/
Once installed, you'll be able to use the same terminal commands we use in this book.
🏠 The Home Directory
Every user has a personal home directory. It's like your bedroom in the computer's house.
- On Linux/macOS, it looks like:
/home/alex/
or
/Users/alex/
This is where all your stuff (documents, downloads, code) lives.
📜 Paths and File Extensions
-
A path tells the computer where something is. Example:
/home/alex/projects/rust_for_kids/main.rs
-
A file extension tells what kind of file it is:
-
.txt
→ text -
.jpg
→ image -
.rs
→ Rust code -
.exe
→ Windows program
💻 The Terminal is a Magic Door 🧙♂️
The terminal (or "command line") is a tool to talk directly to your computer.
You don't click, you type! It's like writing spells.
Programmers love the terminal because it's powerful and fast.
🔤 Terminal Command Cheat Sheet
Command | What it does |
---|---|
pwd | Show where you are right now |
ls | List everything in the current folder |
cd foldername | Enter a folder |
cd .. | Go up one level (to the parent folder) |
cd . | Stay where you are (the "current directory") |
mkdir my_folder | Make a new folder |
touch hello.txt | Create a new empty file |
cat hello.txt | Show what's inside the file |
rm file.txt | Delete a file (⚠️ careful!) |
mv file.txt newname.txt | Rename a file |
mv file.txt folder/ | Move a file into a folder |
clear | Clean the screen |
Tip: You can press the up arrow ↑ to repeat your last command!
🧭 Terminal Challenge!
Try this in your terminal:
mkdir rust_games
cd rust_games
touch hello.txt
cat hello.txt
You're now a file system explorer!
🧭 Mini Terminal Adventure
Try this:
mkdir my_story
cd my_story
touch chapter1.txt
echo "Once upon a time..." > chapter1.txt
cat chapter1.txt
mv chapter1.txt intro.txt
cd ..
ls
You just:
- ✅ created a folder
- ✅ entered it
- ✅ created and edited a file
- ✅ renamed the file
- ✅ went back up a folder
- ✅ listed what's there!
The Language of Machines: Binary Basics
🧠 What Is a Bit?
A bit is the smallest piece of data a computer can store.
It can only be 1 (on 💡) or 0 (off ⚫), like a flashlight switch!
A byte is a group of 8 bits. With 8 bits, we can count from 0
to 255
because:
2^8 = 256
🧮 Decimal vs Binary
We usually count in decimal (base 10):
Digit Position | Sixth | Fifth | Fourth | Third | Second | First |
---|---|---|---|---|---|---|
Power of 10 | 10⁵ | 10⁴ | 10³ | 10² | 10¹ | 10⁰ |
Decimal Value | 100000 | 10000 | 1000 | 100 | 10 | 1 |
Digit | 6 | 5 | 4 | 3 | 2 | 1 |
Each digit is worth 10 times more than the one next to it (1, 10, 100...).
But computers count in binary (base 2):
We use only 0 and 1 (base 2):
Bit Position | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
---|---|---|---|---|---|---|---|---|
Power of 2 | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
Decimal Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Example Bits | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
This is what 01010101
means:
Just add up the positions where there's a 1 to get the number!
01010101
→ 64 + 16 + 4 + 1 = 85
🧮 Binary Conversion Table
Here are the first 16 numbers in decimal and binary
Decimal | Binary | Decimal | Binary |
---|---|---|---|
0 | 0000 | 8 | 1000 |
1 | 0001 | 9 | 1001 |
2 | 0010 | 10 | 1010 |
3 | 0011 | 11 | 1011 |
4 | 0100 | 12 | 1100 |
5 | 0101 | 13 | 1101 |
6 | 0110 | 14 | 1110 |
7 | 0111 | 15 | 1111 |
Try finding your age in binary!
🔢 Tip: With 4 bits, you can count from 0 to 15. That's
2⁴ = 16
combinations!
🔤 What About Letters?
Computers also store text as numbers, using something called ASCII.
For example:
Character | ASCII Decimal | Binary |
---|---|---|
A | 65 | 01000001 |
B | 66 | 01000010 |
C | 67 | 01000011 |
a | 97 | 01100001 |
So "Hi"
= 01001000 01101001
in binary!
💾 Bytes, Kilobytes, Megabytes…
Let's zoom out!
Unit | Description |
---|---|
1 Byte | = 8 bits |
1 Kilobyte | = 1024 Bytes |
1 Megabyte | = 1024 KB |
1 Gigabyte | = 1024 MB |
1 Terabyte | = 1024 GB |
1 Petabyte | = 1024 TB |
Binary Numbers for Kids
🧪 Try This!
- Write the number
7
in binary - Convert the word
OK
to ASCII + binary - What's the biggest number you can make with 8 bits?
- Find the binary for the word
RUST
✅ Summary
- Computers only understand 1s and 0s: binary.
- A bit is one 1/0; a byte is 8 bits.
- We use ASCII to turn text into numbers.
- Memory is measured in units like KB, MB, GB, TB, etc.
Welcome to Rust
Now that you know how computers work and how they think, it's time to start programming! In this section, you'll meet Rust, a fast, fun, and powerful language used by real engineers all over the world. And now, by you! 🎉
We'll guide you through installing Rust, writing your first "Hello, world!" program, and learning the most important building blocks: variables, data types, functions, and loops. Along the way, you'll discover how to make decisions in code, repeat actions, and add helpful comments that make your programs easier to understand. Step by step, you'll become a real Rustacean, someone who speaks computer with claws! 🦀💻
Let's dive in!
Installing Rust
🚀 Let's Get Started!
To write Rust programs, we need to install:
- 🦀
rustc
: the Rust compiler - 📦
cargo
: the Rust project manager (like a magic toolbox)
These tools come together in something called rustup.
🛠️ Step 1: Install Rust
Open your terminal and paste this command:
curl https://sh.rustup.rs -sSf | sh
Then follow the instructions that appear.
✅ Works on Linux, macOS, and WSL (Windows Subsystem for Linux)
🧪 Step 2: Check the Installation
Once it's done, check that everything works:
rustc --version
cargo --version
You should see something like:
rustc 1.xx.x
cargo 1.xx.x
📝 Step 3: Write Your First Rust Program!
Let's create a folder for our first project:
cargo new hello_rust
cd hello_rust
Now open the file src/main.rs
and you'll see:
fn main() { println!("Hello, world!"); }
▶️ Step 4: Run Your Program
In the same folder, run:
cargo run
You should see:
Compiling hello_rust v0.1.0
Finished dev [unoptimized + debuginfo]
Running `target/debug/hello_rust`
Hello, world!
🎉 Congratulations! You just wrote and ran your first Rust program!
✅ Summary
- Installed Rust with
rustup
- Verified
rustc
andcargo
are working - Created a new project with
cargo new
- Ran your first Rust code with
cargo run
Let's move on and learn what this code means! 🦀💡
Hello, Rustacean!
👋 Hello, World!
Now that Rust is installed... Let's write your first program!
Open the main.rs
file inside your project folder (hello_rust/src/main.rs
), and you'll see this:
fn main() { println!("Hello, world!"); }
Let's break it down...
🧱 Anatomy of a Rust Program
fn main() { println!("Hello, world!"); }
- 🔹
fn
means function - 🔹
main()
is where the program starts - 🔹
{ ... }
is a code block - 🔹
println!
prints a message to the terminal - 🔹
"Hello, world!"
is a string - 🔹
!
means it's a macro - 🔹 Every line ends with a semicolon
;
🖨️ What is println!
?
println!
is a macro that prints text to the screen.
#![allow(unused)] fn main() { println!("Hello, Rustacean!"); }
You can print anything inside the quotes!
Example:
#![allow(unused)] fn main() { println!("My favorite number is {}", 42); }
The {}
gets replaced with the value. It's like a mini magic placeholder!
💬 Add Some Comments
Comments are notes for humans. Rust ignores them.
You write them like this:
#![allow(unused)] fn main() { // This is a single-line comment /* This is a multi-line comment */ }
Comments help you explain what your code does!
✨ Challenge Time!
Try changing your code:
- ✅ Print your name
- ✅ Print your age
- ✅ Print something in your own language
- ✅ Add a comment that explains what you did
✅ Summary
- You wrote your first Rust program!
- Learned about
fn
,main
, andprintln!
- Understood how macros and strings work
- Learned how to write comments
Variables: Your Code's Memory
📦 What is a Variable?
A variable is like a box 🧰 with a name, where you can store a value.
In Rust, we use the keyword let
to create one:
#![allow(unused)] fn main() { let age = 10; }
This means:
"Create a box named age
and put the number 10
inside."
🧠 Variables Store Information
You can store different types of values:
#![allow(unused)] fn main() { let age = 10; // i32 → integer let name = "Alex"; // &str → text let is_rust_fun = true; // bool → true or false }
Rust usually figures out the type for you (this is called type inference).
But you can also be explicit:
#![allow(unused)] fn main() { let score: i32 = 100; let name: String = String::from("Zoe"); }
🔄 What If I Want to Change It?
Rust makes variables immutable by default: they cannot be changed.
#![allow(unused)] fn main() { let age = 10; age = 11; // ❌ error! }
If you want to change it, use mut
(for "mutable"):
#![allow(unused)] fn main() { let mut age = 10; // Now it's mutable age = 11; // ✅ now it works! }
💡 Tip: Rust helps you write safer code by making things immutable by default.
🧪 Mini Challenge
Try writing this in your main.rs
:
#![allow(unused)] fn main() { let mut score = 0; println!("Score: {}", score); score = 5; println!("New score: {}", score); }
🧠 Common Variable Types
Type | Example | Description |
---|---|---|
i32 | let x = 5; | Integer (32-bit number) |
bool | let done = true; | True or false |
String | let name = String::from("Zoe"); | Text (owned string) |
Rust is a statically typed language: every variable has a type!
✅ Summary
- Variables hold information: like numbers, text, or true/false values
- Use
let
to create variables - Use
mut
to make them changeable - Rust has powerful, safe types like
i32
,bool
, andString
Data Types: The Building Blocks of Rust
Functions: The Magic of Reusable Code
Control Flow: Making Decisions in Code
Loops: Repeating Actions in Rust
Rustacean Thinking
Now that you've learned the basics of writing Rust code, it's time to explore what makes Rust truly special. In this section, you'll dive into the core ideas that make Rust different and powerful.
You'll discover the magic behind ownership, Rust's unique way of managing memory safely and efficiently. You'll learn how to borrow values without copying them, how to work with mutable data, and how Rust helps you catch errors before your program even runs. We'll also explore how to build your own custom types using structs and enums, and how to use pattern matching to write smart and clean code.
These are the tools and ideas that real Rustaceans use every day, and soon, you will too! 🦀🚀
Ownership: The Heart of Rust
Borrowing and References: Sharing Without Copying
The Power of Mutability
Error Handling: Keeping Your Code Safe
Structs: Custom Data Types in Rust
Enums: Defining Your Own Types
Pattern Matching: A Powerful Tool
📚 Resources
🎓 Resources for Students
📖 Cheatsheets and References
📘 Featured Tutorials and Articles
- Introduction to the Rust State Machine. A practical introduction to the state machine in Rust, useful for understanding how to structure protocols or systems with phase changes.
📚 Recommended Books
- The Rust Programming Language, Steve Klabnik, Carol Nichols. No Starch Press; 2nd edition (2023)
- Programming Rust: Fast, Safe Systems Development, Jim Blandy, Jason Orendorff, Leonora F S Tindall. O'Reilly Media; 2nd edition (2021)
- Rust for Rustaceans: Idiomatic Programming for Experienced Developers, Jon Gjengset. No Starch Press; 1st edition (2021)
- Rust in Action, Tim McNamara. Manning Publications; 1st edition (2021)
Mozilla Public License Version 2.0
1. Definitions
1.1. “Contributor”
means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.
1.2. “Contributor Version”
means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution.
1.3. “Contribution”
means Covered Software of a particular Contributor.
1.4. “Covered Software”
means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof.
1.5. “Incompatible With Secondary Licenses”
means
- that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or
- that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License.
1.6. “Executable Form”
means any form of the work other than Source Code Form.
1.7. “Larger Work”
means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software.
1.8. “License”
means this document.
1.9. “Licensable”
means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License.
1.10. “Modifications”
means any of the following:
- any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or
- any new file in Source Code Form that contains any Covered Software.
1.11. “Patent Claims” of a Contributor
means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version.
1.12. “Secondary License”
means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses.
1.13. “Source Code Form”
means the form of the work preferred for making modifications.
1.14. “You” (or “Your”)
means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
2. License Grants and Conditions
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
- under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and
- under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor:
- for any code that a Contributor has removed from Covered Software; or
- for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or
- under Patent Claims infringed by Covered Software in the absence of its Contributions.
This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1.
3. Responsibilities
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
- such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and
- You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s).
3.4. Notices
You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction.
4. Inability to Comply Due to Statute or Regulation
If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
5. Termination
5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination.
6. Disclaimer of Warranty
Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer.
7. Limitation of Liability
Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
8. Litigation
Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims.
9. Miscellaneous
This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor.
10. Versions of the License
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://www.mozilla.org/en-US/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - “Incompatible With Secondary Licenses” Notice
This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.