Convert Figma logo to code with AI

rust-lang logobook

The Rust Programming Language

14,881
3,363
14,881
251

Top Related Projects

1,102

Online resources for Python Crash Course, 3rd edition, from No Starch Press.

Deprecated, please use the TypeScript-Website repo instead

A book series on JavaScript. @YDKJS on twitter.

122,720

The Go programming language

62,176

The Python programming language

:books: Freely available programming books

Quick Overview

The rust-lang/book repository contains the source for "The Rust Programming Language," which is the official book for learning Rust. It provides a comprehensive guide to the Rust programming language, covering everything from basic syntax to advanced concepts, making it an essential resource for both beginners and experienced developers.

Pros

  • Comprehensive and well-structured content covering all aspects of Rust
  • Regularly updated to reflect the latest changes in the Rust language
  • Available for free online and in multiple formats (HTML, PDF, EPUB)
  • Includes practical examples and exercises to reinforce learning

Cons

  • May be overwhelming for absolute beginners due to its depth and breadth
  • Some advanced topics might require additional resources or prior programming experience
  • Updates to the book may lag behind the latest Rust releases
  • Limited coverage of some ecosystem tools and third-party libraries

Getting Started

To get started with "The Rust Programming Language" book:

  1. Visit the official Rust website: https://www.rust-lang.org/learn
  2. Click on "Read the Book" to access the online version
  3. Alternatively, clone the repository and build the book locally:
git clone https://github.com/rust-lang/book.git
cd book
cargo install mdbook
mdbook build
mdbook serve --open

This will open the book in your default web browser, allowing you to read and navigate through the content.

Competitor Comparisons

1,102

Online resources for Python Crash Course, 3rd edition, from No Starch Press.

Pros of Python Crash Course

  • More beginner-friendly with a gradual learning curve
  • Includes practical projects and real-world applications
  • Covers a wider range of topics, including web development and data visualization

Cons of Python Crash Course

  • Less comprehensive coverage of language fundamentals
  • May not delve as deeply into advanced concepts
  • Updates less frequently compared to The Rust Programming Language

Code Comparison

Python Crash Course:

def greet_user(username):
    print(f"Hello, {username}!")

greet_user("Alice")

The Rust Programming Language:

fn greet_user(username: &str) {
    println!("Hello, {}!", username);
}

fn main() {
    greet_user("Alice");
}

Both examples demonstrate a simple function that greets a user. The Python version is more concise, while the Rust version includes explicit type annotations and a separate main function, reflecting the language's focus on safety and control.

Python Crash Course is an excellent resource for beginners learning Python, offering practical projects and a gentle introduction to programming. The Rust Programming Language, on the other hand, provides a more in-depth exploration of Rust's unique features and concepts, making it ideal for those seeking a deeper understanding of systems programming and memory safety.

Deprecated, please use the TypeScript-Website repo instead

Pros of TypeScript-Handbook

  • More comprehensive coverage of advanced topics and language features
  • Includes interactive code examples through the TypeScript Playground
  • Regularly updated to reflect the latest TypeScript versions

Cons of TypeScript-Handbook

  • Less structured learning path for beginners
  • Fewer practical examples and exercises compared to the Rust book
  • Documentation can be more technical and less beginner-friendly

Code Comparison

TypeScript-Handbook example:

interface Person {
  name: string;
  age: number;
}

function greet(person: Person) {
  return `Hello, ${person.name}!`;
}

Rust book example:

struct Person {
    name: String,
    age: u32,
}

fn greet(person: &Person) -> String {
    format!("Hello, {}!", person.name)
}

Both examples demonstrate similar concepts (defining a struct/interface and a function), but TypeScript uses interfaces and type annotations, while Rust uses structs and explicit types. The Rust example also shows ownership concepts with the & reference.

The TypeScript-Handbook provides a comprehensive resource for TypeScript developers, excelling in advanced topics and interactive examples. However, the Rust book offers a more structured learning path and beginner-friendly approach, making it easier for newcomers to grasp the language fundamentals.

A book series on JavaScript. @YDKJS on twitter.

Pros of You-Dont-Know-JS

  • Comprehensive coverage of JavaScript fundamentals and advanced concepts
  • Free and open-source, accessible to all learners
  • Regular updates to keep pace with evolving JavaScript standards

Cons of You-Dont-Know-JS

  • Focuses solely on JavaScript, lacking the broader programming context
  • May be overwhelming for absolute beginners due to its depth
  • Less structured learning path compared to The Rust Programming Language book

Code Comparison

You-Dont-Know-JS (JavaScript):

function foo(x) {
    var y = x * 2;
    return function bar(z) {
        return y + z;
    };
}

The Rust Programming Language (Rust):

fn foo(x: i32) -> impl Fn(i32) -> i32 {
    let y = x * 2;
    move |z| y + z
}

Both examples demonstrate closure concepts, but Rust's implementation showcases its strong typing and ownership model.

You-Dont-Know-JS offers an in-depth exploration of JavaScript, making it ideal for those seeking to master the language. The Rust Programming Language book provides a more structured approach to learning Rust, with a focus on systems programming concepts. While You-Dont-Know-JS is more specialized, The Rust Programming Language offers a broader programming education within the context of Rust.

122,720

The Go programming language

Pros of go

  • Larger and more comprehensive repository, containing the entire Go language implementation
  • Includes extensive test suites and benchmarks for the language
  • Contains tools and utilities for Go development beyond just documentation

Cons of go

  • Less focused on beginner-friendly learning materials compared to book
  • May be overwhelming for newcomers due to its size and complexity
  • Documentation is spread across multiple files and directories, potentially making it harder to navigate

Code Comparison

book (Rust):

fn main() {
    println!("Hello, world!");
}

go (Go):

package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}

Summary

The go repository is a comprehensive resource for the Go programming language, including its implementation, tools, and tests. It offers a wealth of information for experienced developers but may be less accessible for beginners. The book repository, on the other hand, is specifically designed as a learning resource for Rust, making it more approachable for newcomers to the language. While go provides a complete view of the language ecosystem, book focuses on structured, educational content. The code comparison shows the slight differences in syntax between Rust and Go for a simple "Hello, world!" program.

62,176

The Python programming language

Pros of cpython

  • Larger, more established codebase with a longer history
  • Implements the full Python language, not just documentation
  • Includes extensive test suites and benchmarks

Cons of cpython

  • More complex and harder to navigate for beginners
  • Written in C, which may be less accessible to some contributors
  • Larger codebase requires more time to understand and contribute to

Code Comparison

cpython (Python implementation):

static PyObject *
builtin_abs(PyObject *module, PyObject *x)
{
    return PyNumber_Absolute(x);
}

book (Rust documentation):

fn main() {
    println!("Hello, world!");
}

The cpython example shows a C function implementing the built-in abs() function in Python, while the book example is a simple "Hello, world!" program in Rust, demonstrating the difference in focus between the two repositories.

cpython is the reference implementation of the Python programming language, containing the core language implementation, standard library, and tools. In contrast, book is a repository for "The Rust Programming Language" book, which serves as the main documentation for learning Rust.

While cpython provides the actual language implementation, book focuses on teaching Rust through comprehensive documentation and examples. This fundamental difference in purpose leads to distinct codebases, contribution processes, and target audiences for each project.

:books: Freely available programming books

Pros of free-programming-books

  • Covers a wide range of programming languages and topics
  • Community-driven with frequent updates and contributions
  • Free and accessible to everyone, promoting open education

Cons of free-programming-books

  • Lacks a structured learning path or curriculum
  • Quality and depth of resources may vary
  • No interactive exercises or hands-on coding examples

Code comparison

Not applicable, as free-programming-books is a curated list of resources rather than a programming guide with code examples. The book, on the other hand, provides Rust code snippets throughout its content.

Example from the book:

fn main() {
    println!("Hello, world!");
}

free-programming-books doesn't contain code examples, but rather links to external resources:

* [The Rust Programming Language](https://doc.rust-lang.org/book/) - Steve Klabnik and Carol Nichols

Both repositories serve different purposes: the book is a comprehensive guide for learning Rust, while free-programming-books is a collection of free programming resources across various languages and topics. The book offers a structured approach to learning Rust with code examples and explanations, while free-programming-books provides a vast array of resources for self-directed learning across multiple programming languages and subjects.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

The Rust Programming Language

Build Status

This repository contains the source of "The Rust Programming Language" book.

The book is available in dead-tree form from No Starch Press.

You can also read the book for free online. Please see the book as shipped with the latest stable, beta, or nightly Rust releases. Be aware that issues in those versions may have been fixed in this repository already, as those releases are updated less frequently.

See the releases to download just the code of all the code listings that appear in the book.

Requirements

Building the book requires mdBook, ideally the same version that rust-lang/rust uses in this file. To get it:

$ cargo install mdbook --locked --version <version_num>

Building

To build the book, type:

$ mdbook build

The output will be in the book subdirectory. To check it out, open it in your web browser.

Firefox:

$ firefox book/index.html                       # Linux
$ open -a "Firefox" book/index.html             # OS X
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
$ start firefox.exe .\book\index.html           # Windows (Cmd)

Chrome:

$ google-chrome book/index.html                 # Linux
$ open -a "Google Chrome" book/index.html       # OS X
$ Start-Process "chrome.exe" .\book\index.html  # Windows (PowerShell)
$ start chrome.exe .\book\index.html            # Windows (Cmd)

To run the tests:

$ mdbook test

Contributing

We'd love your help! Please see CONTRIBUTING.md to learn about the kinds of contributions we're looking for.

Because the book is printed, and because we want to keep the online version of the book close to the print version when possible, it may take longer than you're used to for us to address your issue or pull request.

So far, we've been doing a larger revision to coincide with Rust Editions. Between those larger revisions, we will only be correcting errors. If your issue or pull request isn't strictly fixing an error, it might sit until the next time that we're working on a large revision: expect on the order of months or years. Thank you for your patience!

Translations

We'd love help translating the book! See the Translations label to join in efforts that are currently in progress. Open a new issue to start working on a new language! We're waiting on mdbook support for multiple languages before we merge any in, but feel free to start!

Spellchecking

To scan source files for spelling errors, you can use the spellcheck.sh script available in the ci directory. It needs a dictionary of valid words, which is provided in ci/dictionary.txt. If the script produces a false positive (say, you used the word BTreeMap which the script considers invalid), you need to add this word to ci/dictionary.txt (keep the sorted order for consistency).