BuildOn Introduction

BuildOn

BuildOn is a process for learning Rust programming by writing code. You need to have some skill in a modern programming language, but need have no past experience with Rust. The process takes you through a series of steps building interesting, not too complex, projects. Each step will start with a remote presentation that:
  1. Looks at my implementation of the previous step's code, usually a single package.
  2. Answers questions you may have about the implementation during remote session. You can also post questions, while working on your code, on a Discord server set up for that purpose.
    I may answer a few. The intent is that your questions will often be answered by friends and colleagues, also working on the BuildOn.
  3. Presents the next step's specification.
  4. Discusses things you need to learn about Rust for that next step.
  5. Provides links to Rust reference materials here or, for question specific details, on the Discord Server.
Each succeeding step adds another package to the project. Steps are organized so that you only need to learn a relatively small part of Rust to complete the current step. Later steps get into progressively more language details. I plan to post a video of each remote session on YouTube with links to that in the Discord server and in these web pages.
 

Why Rust?

Rust is an interesting language, combining memory safety of C# and Java with performance of C++. Unlike these languages, Rust also provides data race safety by construction. Using modern idioms, one can build, with C++, memory safe programs without data races. But when building large systems, with many thousands of lines of code, it is easy to forget, in a few of those lines, to use an idiom or unintentionally share data between threads without proper locking. C++ is memory and data race safe by convention. Rust, however, ensures memory and data safety by construction. Code with unsafe memory access and data races will fail to compile. It accomplishes that with an intersting ownership model. There are a number of ideas, implemented in Rust, that work in concert to provide memory and data race safety. Those are discussed in some detail in:
Rust Bite - Safety
Take a quick look now and come back to study in more detail as you begin coding in Rust.
 

Exercises:

Note:
The Rust Playground is a nice facility for working on small exercises. It provides access to the Rust Compiler in a web interface - quick and easy. You save your work by using the "share" button on the top right. Click it, choose premalink and, when it returns, click on the icon to save a link to your code in the clipboard. You now have to save the link to your desktop, word page, OneNote, ...
In order to build and run with cargo from the Visual Studio Code terminal you need to open VS Code in the package folder for the code you want to build and run. That's the folder where the package cargo.toml file resides.

  1. Before you do anything else, read/view all the contents of GettingStarted Table 1.a. You can do that in a morning.
  2. Look at RustBites Undefined Behavior to understand problems with C++ data management and mechanisms Rust uses to avoid them.
  3. Look at Getting Started Table 2. and explore all of the playground links.
  4. Read RustBites Data and do the exercises at the end.
  5. Look at RustBites FlashCards and explore all of the playground links.
 

Getting Started References

Table 1., below, provides a few references suitable for Rust beginners. They all assume competence in some modern programming language, but not with Rust.
 

Table 1. - Beginning Rust References

Topic Description Link
Comparison A quick taste of how C++, Rust, and C# are similar and different - the infamous HelloWorld program. Hello Worlds
Rust in a Nutshell Brief discussion of Rust codes with simple examples. Rust in a Nutshell
Intro to data ops & Ownership Excellent introduction to Rust's ownership model with simple metaphors. into_rust()
Start with first three refs, above. The rest, below, will be useful later.
Survey This is an extensive github Readme.md file with table of contents and most of the ideas expressed in simple language with lots of details. easy-rust
Syntax This is is a github Gist that presents much of the Rust syntax without much drill-down. This is a good starting place, but you will find, as you learn Rust, that a lot is missing here. But starting out, that is probably a good thing. Almost all the missing details you can find in the previous easy-rust link. syntax guide
Safety Rust definitions, invariants, syntax checking rules, and types that make Rust code safe by construction. Rust Bites Safety
Ownership Discussion of the ownership rules with several small code examples. Read Safety first. Rust Bites Ownership
Rust Story A narrative walk through of the Rust Language, provided by this site. Rust Story
Rust Bite by Byte A sequence of small bites from the Rust language with examples. Rust Bites
Book of Books A series of official and unofficial web-based books. This is a great place to start and continue your Rust journey, from quite basic to quite advanced. Little Book of Rust Books
The first three references are the things to look at first. The rest you might skim over, just to see what is there, and come back later for details as you need them.
 
 toggle menu