## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

# The Rust Programming Language

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Getting Started

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Guessing Game

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Syntax and Semantics

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Variable Bindings

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Functions

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Primitive Types

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Comments

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# if

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Loops

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Vectors

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Ownership

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# References and Borrowing

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Lifetimes

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Mutability

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Structs

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Enums

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Match

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Patterns

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Method Syntax

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Strings

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Generics

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Traits

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Drop

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# if let

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Trait Objects

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Closures

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Universal Function Call Syntax

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Crates and Modules

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# const and static

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Attributes

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Type Aliases

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Casting Between Types

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Associated Types

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Unsized Types

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Operators and Overloading

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# `Deref` coercions

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Macros

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Raw Pointers

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Unsafe

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Effective Rust

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# The Stack and the Heap

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Testing

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Conditional Compilation

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Documentation

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Iterators

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Concurrency

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Error Handling

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Choosing your Guarantees

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Foreign Function Interface

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Borrow and AsRef

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Release Channels

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Using Rust Without the Standard Library

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Procedural Macros (and custom Derive)

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Glossary

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Syntax Index

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.

# Bibliography

The first edition of the book is no longer distributed with Rust’s documentation.

If you came here via a link or web search, you may want to check out the current version of the book instead.

If you have an internet connection, you can find a copy distributed with Rust 1.30.