rust-koans:Rust编程语言的Koans

  • K3_915955
    了解作者
  • 15.5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-25 02:15
    上传日期
鲁斯特·科恩斯(Rust Koans) 结构 koans按文件划分为多个区域,arrays.rs中覆盖了数组,booleans.rs中引入了布尔值,等等。它们在path_to_enlightenment.rs文件中按顺序显示。 每个koan都会建立您对Rust的知识并在自身之上建立。 通过遵循提出的故障和错误,您将知道下一步的工作。 当您完成一个koan文件时,下一个文件将被添加到path_to_enlightenment.rs中。 有些koan只需用正确的答案代替不正确的答案即可。 但是,有些要求您提供自己的答案。 如果看到列出的__(双下划线),则提示您提供自己的代码以使其正常工作。 安装Rust 如果您没有Rust设置,请访问以获取特定的操作说明。 为了运行koans,您需要安装Rust。 要检查您的安装,只需键入: *从任何终端窗口访问的nix平台: $ rustc --
rust-koans-master.zip
  • rust-koans-master
  • .gitignore
    36B
  • README.md
    2.2KB
  • Cargo.toml
    113B
  • build.rs
    480B
  • src
  • koans.txt
    85B
  • koans
  • boolean.rs
    623B
  • array.rs
    3.1KB
  • string.rs
    2.7KB
  • integer.rs
    1.4KB
  • the_truth.rs
    43B
  • hash_map.rs
    2.9KB
  • ownership.rs
    4.3KB
  • traits.rs
    4.8KB
  • addition.rs
    52B
  • struct.rs
    1.9KB
  • vec.rs
    4.9KB
  • main.rs
    1.5KB
  • LICENSE.md
    1.1KB
  • Cargo.lock
    46B
内容介绍
# Rust Koans ## The Structure The koans are broken out into areas by file, arrays are covered in arrays.rs, booleans are introduced in boolean.rs, etc. They are presented in order in the path_to_enlightenment.rs file. Each koan builds up your knowledge of Rust and builds upon itself. By following the failures and errors presented, you will know what to work on next. As you finish one koan file, the next will be added to path_to_enlightenment.rs. Some koans simply need to have the correct answer substituted for an incorrect one. Some, however, require you to supply your own answer. If you see the __ (a double underscore) listed, it is a hint to you to supply your own code in order to make it work correctly. ## Installing Rust If you do not have Rust setup, please visit [rust-lang.org](https://www.rust-lang.org/) for operating specific instructions. In order to run the koans you need Rust installed. To check your installations simply type: *nix platforms from any terminal window: ``` $ rustc --version ``` Currently, a Rust version of 1.3.0 or higher is recommended. ## The Path to Englightenment In order to run the koans, **Clone** this repository, and from the root folder simply run: ``` $ cargo run ``` This will generate the `path_to_enlightenment.rs` file and populate it with the first test in the list. After supplying an answer for the first test case, entering `cargo run` again will continue you on your path. ### Red, Green, Refactor Red, Green, Refactor In test-driven development the mantra has always been red, green, refactor. Write a failing test and run it (red), make the test pass (green), then look at the code and consider if you can make it any better (refactor). While walking the path to Rust enlightenment you will need to run the koan and see it fail (red), make the test pass (green), then take a moment and reflect upon the test to see what it is teaching you and improve the code to better communicate its intent (refactor). ## Other Resources The Rust Language | https://www.rust-lang.org/ ---------------------|---------------------------- Rust Playground | https://play.rust-lang.org/ The Book (Rust docs) | https://doc.rust-lang.org/book/
评论
    相关推荐