Coder Social home page Coder Social logo

hijiangtao / learn-rust-with-rustlings Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 2.0 45 KB

🎉 Rustlings Solutions (Rustlings 解题集)

Home Page: https://github.com/hijiangtao

License: MIT License

Rust 95.73% Shell 4.27%
rust rust-library rust-lang rustlings rustlings-solution solutions

learn-rust-with-rustlings's Introduction

learn-rust-with-rustlings

README (EN)

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

This repo is my rustlings' solution collection. Hope it can help you more or less. :)

🎉 Successfully compiled all rustlings exercises! All the answers can be found in corresponding folders. For example, you can check file exercises/strings/strings1.rs to read my solution about strings chapter.

  • ✅ if
  • ✅ functions
  • ✅ variables
  • ✅ primitive_types
  • ✅ strings
  • ✅ modules
  • ✅ macros
  • ✅ move_semantics
  • ✅ error_handling
  • ✅ threads
  • ✅ standard_library_types

README (CN)

🎉 Rust 学习之 Rustlings 训练答案集,所有训练均已完成。

内容在具体的文件中可以查看,比如 strings 为已完成状态,则对应 exercises/strings/strings1.rs 文件中代码即为答案,以下为训练分章节目录。

  • ✅ if
  • ✅ functions
  • ✅ variables
  • ✅ primitive_types
  • ✅ strings
  • ✅ modules
  • ✅ macros
  • ✅ move_semantics
  • ✅ error_handling
  • ✅ threads
  • ✅ standard_library_types

Manually Installation

Basically: Clone the repository, checkout to the latest tag, run cargo install.

git clone https://github.com/hijiangtao/learn-rust-with-rustlings
cd learn-rust-with-rustlings
cargo install --force --path .

If there are installation errors, ensure that your toolchain is up to date. For the latest, run:

rustup update

Then, same as above, run rustlings to get started.

Doing exercises

The exercises are sorted by topic and can be found in the subdirectory rustlings/exercises/<topic>. For every topic there is an additional README file with some resources to get you started on the topic. We really recommend that you have a look at them before you start.

The task is simple. Most exercises contain an error that keep it from compiling, and it's up to you to fix it! Some exercises are also run as tests, but rustlings handles them all the same. To run the exercises in the recommended order, execute:

rustlings watch

This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers). It will also rerun automatically every time you change a file in the exercises/ directory. If you want to only run it once, you can use:

rustlings verify

This will do the same as watch, but it'll quit after running.

In case you want to go by your own order, or want to only verify a single exercise, you can run:

rustlings run exercises/path/to/exercise.rs

In case you get stuck, there is usually a hint at the bottom of each exercise.

Testing yourself

After every couple of sections, there will be a test that'll test your knowledge on a bunch of sections at once. These tests are found in exercises/testN.rs.

Contact

@hijiangtao

LICENSE

MIT

learn-rust-with-rustlings's People

Contributors

hijiangtao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

learn-rust-with-rustlings's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.