{"id":13756993,"url":"https://github.com/rustcc/rust-by-example","last_synced_at":"2025-05-10T04:31:13.505Z","repository":{"id":23169890,"uuid":"26525802","full_name":"rustcc/rust-by-example","owner":"rustcc","description":"通过例子学习Rust语言","archived":false,"fork":true,"pushed_at":"2018-11-15T11:04:10.000Z","size":7536,"stargazers_count":134,"open_issues_count":2,"forks_count":28,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-11-16T12:34:37.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rustcc.github.io/rust-by-example/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rust-lang/rust-by-example","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-12T08:11:40.000Z","updated_at":"2024-09-28T14:58:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rustcc/rust-by-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Frust-by-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Frust-by-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Frust-by-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Frust-by-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustcc","download_url":"https://codeload.github.com/rustcc/rust-by-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253365275,"owners_count":21897181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T11:01:00.767Z","updated_at":"2025-05-10T04:31:12.069Z","avatar_url":"https://github.com/rustcc.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"[![Build Status][travis-image]][travis-link]\n# Rust by Example\n\n## 中文版在线预览\n\n- http://rustcc.github.io/rust-by-example/\n- http://rust.cc/rust-by-example/\n\n## 中文版译者注意\n\n请翻译修改 examples 目录及其子目录内的 input_zh-CN.md 文件，内容参考同目录下 input.md 文件内的英文（注意： input_zh-CN.md 内的英文很可能是旧版的，勿直接翻译）。请使用 UTF-8 编码存储中文文档，否则程序不能正确读取，导致最终生成英文版页面。\n尽量不要改其他文件，以方便合并来自官方 upstream 的更新。生成中文版图书的方法请参考Wiki。 —— Liigo。\n\n## What's this?\n\nThis is the source code of the [Rust by Example][website] website!\n\n## How to contribute\n\nSee [CONTRIBUTING.md][how-to-contribute].\n\n## How to generate the static site\n\nFirst, make certain you install `nodejs` on Debian based distributions, or\n`node` on non-Debian distros. After installation, if you use a Debian based\ndistro (i.e. Ubuntu), run:\n\n    sudo ln -s /usr/bin/nodejs /usr/bin/node\n\nThen run:\n\n```\nmake all\nmake book\nmake test\n```\n\nView the results with `make serve`.\n\n### Details\n\nWe use these tools to generate the static site:\n\n* [Rust][rust-lang] \\o/\n* [GitBook][gitbook]\n\n`gitbook` will generate the site from Markdown files (see details about how it\nworks [here][gitbook-format]).\n\nBefore running `gitbook`, we do a preprocessing step using\n[src/main.rs][main-rs].\n\nThis preprocessing has two steps:\n\n### Generating the `SUMMARY.md`\n\n`SUMMARY.md` is generated from the\n[examples/structure.json][structure] file. This JSON file\ncontains a tree-like structure of \"examples\".\n\nEach example has:\n\n* an id, e.g. `hello`\n* a title, e.g. `Hello World`\n* optionally, children, which is a vector of sub-examples, e.g. `null`\n* a directory under `examples`, e.g. [examples/hello][hello-folder]\n* an entry in examples/structure.json, e.g.\n  `{ \"id\": \"hello\", \"title\": \"Hello World\", \"children\": null }`\n* some source file(s), e.g. [examples/hello/hello.rs][hello-rs]\n* an input markdown file, e.g.\n  [examples/hello/input.md][hello-md]\n\nWhen dealing with a child example, the path will have to include the id of its\nancestors; e.g. `examples/variable/mut/input.md`, implies that a `mut` example\nlives under the `variable` example.\n\n### Processing `input.md`\n\nInstead of including the Rust code directly in `input.md`, the code lives in\nseparate source files; the preprocessing step will insert the source code\ninto the Markdown file.\n\nFor example, to insert the source code of the `hello.rs` file, the following\nsyntax is used in the Markdown file:\n\n* `{hello.play}` expands the source code embedded in a live code editor\n* `{hello.rs}` expands to static/plain source code.\n* `{hello.out}` expands to the output of executing the source code.\n\nThe Makefile provides the following recipes:\n\n* `make`: builds `update.rs` and does the preprocessing step\n* `make book`: runs `gitbook` to generate the book\n* `make serve`: runs `gitbook --serve` to generate the book and publishes it\n  under `localhost:4000`\n* `make test`: will check all the rust source files for compilation errors\n\n## License\n\nRust by Example is dual-licensed under the Apache 2.0 license and the MIT\nlicense.\n\nSee LICENSE-APACHE and LICENSE-MIT for more details.\n\n[travis-image]: https://travis-ci.org/rust-lang/rust-by-example.svg?branch=master\n[travis-link]: https://travis-ci.org/rust-lang/rust-by-example\n[website]: http://rustbyexample.com\n[how-to-contribute]: CONTRIBUTING.md\n[rust-lang]: http://www.rust-lang.org/\n[gitbook]: http://www.gitbook.io\n[gitbook-format]: https://github.com/GitbookIO/gitbook#book-format\n[main-rs]: src/main.rs\n[structure]: examples/structure.json\n[hello-folder]: examples/hello\n[hello-rs]: examples/hello/hello.rs\n[hello-md]: examples/hello/input.md\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustcc%2Frust-by-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustcc%2Frust-by-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustcc%2Frust-by-example/lists"}