Expand description

gitlabcrates-iodocs-rshomepage

otarustlings exercise platform. Clone of rustlings.

The point of otarustlings is to learn Rust with hands on exercises and small projects.

Updating & Installation

To install or update otarustlings, use:

cargo install --force otarustlings

How to

First, initialize the exercises:

otarustlings init

This creates the folder exercises with the latest exercises within.

Next, start testing the exercise you wish to solve:

otarustlings start

You can also start a specific exercise with:

otarustlings start week4

Finally, open the exercise in your favorite text editor, i.e. Emacs, and solve the exercise in the way which feels natural.

Once the exercise is compiles and passes the tests, it is marked with a check mark in the menu. With ENTER you can select the next exercise directly.

How to solve the exercises

The semantics of the exercises are usually written as comments. If you see a _ in an invalid position, you need to replace it with something else. If you see a // TODO or todo!() you are supposed to remove that and press them buttons on your keyboard (write code) until the exercise is completed.

Crate-like exercises, which are inside a folder, may have some additional files which you need to read or to modify in order to solve the exercise.

Don’t be afraid to search for solutions online. No real programmer only writes new code, most of the code is copy-pasted from stackoverflow and reddit. Also the later exercises contain tests, marked with #[test], read through them to see more concrete examples of what you are supposed to do.

Subcommands

init

To create the initial exercise directory structure and write the exercises, use:

otarustlings init

The command creates a directory called exercises in the current directory.

Note: init does not overwrite old exercises.

start

To start testing your changes, use:

otarustlings start

The command must be issued in the parent directory of exercises, i.e. the same directory init was called in.

The first thing that is shown is a menu of the exercises. Using up and down arrows, you can change the selection and pressing enter will start testing it.

All changes to the file are monitored and tested. The test output is shown in the terminal.

To return to menu, press Q or ESC.

To quit otarustlings, press Q or ESC in the menu.

CTRL-C can also be used to exit otarustlings.

test

You can use otarustlings to directly test a particular exercise without having to interact with it through the terminal user interface.

otarustlings test week4/B5

The same path qualifier works in start too.

state

NOTE: Only modify THE state if necessary!

To reset (remove) exercises/state.toml you can run:

otarustlings state reset

Development

Read the source code, star and fork the project and submit issues to the repository.

Modules

Enums

Error which composes all the crate’s errors together.
A message from the notify and input threads to the compile thread

Type Definitions

Result with error being of type Error