Go to file
2018-05-24 23:02:05 +02:00
error_handling Fix error_handling examples to use the ? operator 2018-03-06 16:29:37 +01:00
functions Fix line numbers 2018-03-04 14:26:56 -05:00
if Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
macros Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
modules Merge pull request #63 from bjornwsv/patch-1 2018-03-04 16:34:02 -05:00
move_semantics Fix line numbers 2018-03-04 14:26:56 -05:00
primitive_types Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
src/bin Don't be lazy, actually read the file instead of including it at compile time 2018-03-04 14:13:55 -05:00
standard_library_types Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
strings Fix line numbers 2018-03-04 14:26:56 -05:00
tests Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
threads Fix line numbers 2018-03-04 14:26:56 -05:00
variables Fix line numbers 2018-03-04 14:26:56 -05:00
.gitignore Start a script to regenerate README.md from a template 2018-03-04 12:41:55 -05:00
.travis.yml Not having anything to commit isn't an error 2018-03-05 20:05:27 -05:00
Cargo.lock Update to btbytes' prlink because they merged my PR already!! 2018-03-04 14:28:11 -05:00
Cargo.toml Update to btbytes' prlink because they merged my PR already!! 2018-03-04 14:28:11 -05:00
ex1.rs Start of trying to make travis update the readme 2018-03-04 16:56:03 -05:00
ex2.rs Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
ex3.rs Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
ex4.rs Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
ex5.rs Added filename to top of .rs files 2018-02-21 22:09:53 -08:00
LICENSE Update LICENSE year. 2016-03-27 15:57:49 -04:00
README-template.hbs Update the updated book links 2018-03-04 16:31:07 -05:00
README.md [#83] improve README to edit locally 2018-05-24 23:02:05 +02:00

rustlings

Small exercises to get you used to reading and writing Rust code. Includes practice reading and responding to compiler messages!

This repo is very much the smallest thing that could possibly work :)

To do these exercises

Thanks to btbytes' prlinks, you can now click on the links below to load the exercises in the rust playground!

There are infinite correct answers-- the exercises are sometimes left very open-ended. Scroll down in the playground to find comments that have hints.

To do these exercises in your local environment and execute them online afterwards:

  • clone the repo to your local environment: git clone git@github.com:rustlings/rustlings.git
  • edit the rustling that you want, per example variables/variables1.rs
  • run cargo run in the project folder
  • you will notice that you README file was modified and now it has the new content of the file that you edited
  • click in the new URL in the README and you will redirect to the rust playground and the whole file content it will be loaded
  • to execute in the rust playground, just click on run

Need help?

If you need more help or would like to compare solutions, you can ask in #rust-beginners on irc.mozilla.org, the user forum, or the subreddit. If an exercise could be improved in any way, please create an issue or submit a pull request!

Variable bindings

Relevant chapter in The Rust Programming Language

Functions

Relevant chapter in The Rust Programming Language

Primitive types

Relevant chapter in The Rust Programming Language

Tests

Going out of order from the book to cover tests-- many of the following exercises will ask you to make tests pass!

Relevant chapter in The Rust Programming Language

If

Relevant chapter in The Rust Programming Language

Strings

Relevant chapter in The Rust Programming Language

Move semantics

These exercises are adapted from pnkfelix's Rust Tutorial -- thank you Felix!!!

Relevant chapters in the book:

Note that the exercises in this section may look similar to each other but they are subtly different :)

Modules

Relevant chapter in The Rust Programming Language

Macros

Check out:

Error Handling

The Error Handling and Generics sections are relevant.

Standard library types

Arc

The Concurrency section is relevant.

Iterators

Do not adjust your monitors-- iterators 1 and 2 are indeed missing. Iterator 3 is a bit challenging so we're leaving space for some exercises to lead up to it!

Check out the Iterators chapter of the book and the Iterator docs.

Threads

See the Dining Philosophers example and the Concurrency Chapter from the book.

Uncategorized

A few exercises based on things I've encountered or had trouble with getting used to.

To help with this repo/TODO list

  • File issues for problems or suggestions!
  • Contribute more exercises! Anything that took you time to get used to, or that you had trouble with, or that deserves practice would be a good exercise!
  • How could the process of doing these exercises work better? This is an open-ended question :) Are the playground links good enough? Are there ways that we could make going to the next exercise easier without forking the playground??