by Steve Klabnik and Carol Nichols, with contributions from the Rust Community
This version of the text assumes you’re using Rust 1.41.0 or later with edition="2018"
in Cargo.toml of all projects to use Rust 2018 Edition idioms. See the “Installation” section of Chapter 1 to install or update Rust, and see the new Appendix E for information on editions.
The 2018 Edition of the Rust language includes a number of improvements that make Rust more ergonomic and easier to learn. This iteration of the book contains a number of changes to reflect those improvements:
impl Trait
syntax.Result<T, E>
in Tests” that shows how to write tests that use the ?
operator.Note that any code in earlier iterations of The Rust Programming Language that compiled will continue to compile without edition="2018"
in the project’s Cargo.toml, even as you update the Rust compiler version you’re using. That’s Rust’s backward compatibility guarantees at work!
The HTML format is available online at https://doc.rust-lang.org/stable/book/ and offline with installations of Rust made with rustup
; run rustup docs --book
to open.
This text is available in paperback and ebook format from No Starch Press.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/book/index.html