RustStory Repo

RustStory: Introduction

basic knowledge, contents, refs

"If you always do what interests you, at least one person is pleased."
- Katharine Hepburn

1.0  Getting Started

This story covers the Rust Programming Language. Graydon Hoare originally designed Rust at Mozilla Research, with contributions from many others, including Brendan Eich, the creator of JavaScript. The Rust compiler and its libraries are open-source. Rust draws from C++ and echoes some ideas from JavaScript, but adds many features uniquely its own:
  1. Crates and Modules are the building blocks for Rust programs, housed in packages created by Cargo, the Rust package manager.
  2. Data is immutable by default. Use the mut keyword to allow a variable to be modified.
  3. Each value has exactly one owner, but ownership can be transferred. Code can borrow a view of the data without transferring ownership by constructing a reference or a slice.
  4. Traits resemble interfaces or abstract classes and support polymorphic operations. They commonly bound the set of types allowed as type parameters for a generic type.
Rust's goal is a safe system programming language. Safe means Rust-generated code is free of memory access and data race vulnerabilities. System programming language means Rust programs are fast and capable of using platform resources.

1.1  Primary Links

Rust has a rich ecosystem of learning materials - see References in 3.0, below. Here are links to materials from this site:
Link Description
RustModels.pdf Slide presentation:
Type safety, Rust ownership, object model, generics, code structure
Code for RustModels Slides present a number of code fragments. These are the complete programs.
References Things to read and view for more details
This story Models, Data, Operations, Objects, Libraries
Code for this story Complete program sources for code fragments in the story
RustBasicDemos Repository of code demonstrations, many written to explore Rust

1.2 Basic Knowledge

To get started, you need basic knowledge of the language, a tool chain to build programs, and the will to start building with less than perfect knowledge. Rust models are unique - writing code is the only way to fully understand them. Demo code in Rust Basic Demos will help you get started.
  1. Basic Rust Knowledge:
    This story provides some of what you need, along with code examples in the RustBasicDemos repository. Also see the references at the end of this page.
  2. Rust Tool Chain:
    For any environment, download Rust tools. This provides Cargo, the Rust package manager, and rustc, the Rust compiler - all the tooling you need to start. Visual Studio Code
    Rust doesn't come with an IDE, but VS Code gives you a text editor with a terminal pane, from which you run Cargo commands build, run, clean, and more.
    Install the VS Code plugin Rust (rls) for syntax highlighting and code completion. VS Code expects JSON files to configure build and debug launchers. I have found that occasionally hard to use, often requiring more configuration effort than I am willing to spend. Working in the code editor and launching Cargo commands in the terminal works well for me. For Windows, I use the default PowerShell terminal; you can replace that with the Windows CMD terminal. On Linux, the default bash terminal works well.
  3. Now start:
    Download the RustBasicDemos. Open VS Code, open one of the folders in RustBasicDemos, then run Cargo build and Cargo run in the terminal. Output appears in the terminal.

1.3 Story Contents

  1. Prologue
    Getting started.
  2. Rust Models
    Key ideas and background needed for later chapters.
  3. Data
    Types provided by Rust, usage, collection demos.
  4. Operations
    Functions, methods, std library facilities
  5. Structs
    Objects, Traits
  6. Libraries
    Several of the most often used libraries are discussed and code examples provides.
  7. References
    Quite complete set of references for the Rust Programming Language

1.4 References:

Reference Link Description
Rust (Programming Language) - Wikipedia A well-written summary of the Rust language.
Considering Rust - Feb 2020 - Jon Gjengset What-is-it video with code snippets and knowledgeable commentary.
intorust.com A few short screen casts - Nicholas Matsakis, ...
readrust.net/getting-started Nice set of "first-look" posts.
rust-learning repository Extensive list of resources: books, videos, podcasts, ...
A half-hour to learn Rust Code fragments with commentary covering most Rust ideas.
A Gentle Introduction To Rust A solid walkthrough of most Rust ideas.
The Rust Programming Language Long but gentle walkthrough of the Rust language
An alternative introduction to Rust Steve Klabnik
Rust pain-points Steve Donovan
Rust by Example Rust docs - walkthrough of syntax
Getting Started with Rust on Windows and Visual Studio Code Install Rust, Verify, Configure Visual Studio Code, Create Hello World, Create Build Task, Configuring Unit Tests, Configure Debugging,
rust-lang.org home page Links to download and documentation
rust cheat sheet An extensive list of cheats and helpers.
More References Basic, intermediate, and advanced references