├── .gitignore
├── .mds-list
├── LICENSE-APACHE
├── LICENSE-MIT
├── book.toml
├── contrib
├── README.md
└── src
│ ├── SUMMARY.md
│ ├── architecture
│ ├── codebase.md
│ ├── compilation.md
│ ├── console.md
│ ├── files.md
│ ├── index.md
│ ├── packages.md
│ └── subcommands.md
│ ├── design.md
│ ├── index.md
│ ├── issues.md
│ ├── process
│ ├── index.md
│ ├── release.md
│ ├── unstable.md
│ └── working-on-cargo.md
│ └── tests
│ ├── index.md
│ ├── profiling.md
│ ├── running.md
│ └── writing.md
├── docs
├── .nojekyll
├── 404.html
├── FontAwesome
│ ├── css
│ │ └── font-awesome.css
│ └── fonts
│ │ ├── FontAwesome.ttf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ └── fontawesome-webfont.woff2
├── appendix
│ ├── git-authentication.zh.html
│ └── glossary.zh.html
├── ayu-highlight.css
├── book.js
├── clipboard.min.js
├── commands
│ ├── build-commands.zh.html
│ ├── cargo-bench.zh.html
│ ├── cargo-build.zh.html
│ ├── cargo-check.zh.html
│ ├── cargo-clean.zh.html
│ ├── cargo-doc.zh.html
│ ├── cargo-fetch.zh.html
│ ├── cargo-fix.zh.html
│ ├── cargo-generate-lockfile.zh.html
│ ├── cargo-help.zh.html
│ ├── cargo-init.zh.html
│ ├── cargo-install.zh.html
│ ├── cargo-locate-project.zh.html
│ ├── cargo-login.zh.html
│ ├── cargo-metadata.zh.html
│ ├── cargo-new.zh.html
│ ├── cargo-owner.zh.html
│ ├── cargo-package.zh.html
│ ├── cargo-pkgid.zh.html
│ ├── cargo-publish.zh.html
│ ├── cargo-report.zh.html
│ ├── cargo-run.zh.html
│ ├── cargo-rustc.zh.html
│ ├── cargo-rustdoc.zh.html
│ ├── cargo-search.zh.html
│ ├── cargo-test.zh.html
│ ├── cargo-tree.zh.html
│ ├── cargo-uninstall.zh.html
│ ├── cargo-update.zh.html
│ ├── cargo-vendor.zh.html
│ ├── cargo-verify-project.zh.html
│ ├── cargo-version.zh.html
│ ├── cargo-yank.zh.html
│ ├── cargo.zh.html
│ ├── general-commands.zh.html
│ ├── index.zh.html
│ ├── manifest-commands.zh.html
│ ├── package-commands.zh.html
│ └── publishing-commands.zh.html
├── css
│ ├── chrome.css
│ ├── general.css
│ ├── print.css
│ └── variables.css
├── elasticlunr.min.js
├── faq.zh.html
├── favicon.ico
├── favicon.png
├── favicon.svg
├── fonts
│ ├── OPEN-SANS-LICENSE.txt
│ ├── SOURCE-CODE-PRO-LICENSE.txt
│ ├── fonts.css
│ ├── open-sans-v17-all-charsets-300.woff2
│ ├── open-sans-v17-all-charsets-300italic.woff2
│ ├── open-sans-v17-all-charsets-600.woff2
│ ├── open-sans-v17-all-charsets-600italic.woff2
│ ├── open-sans-v17-all-charsets-700.woff2
│ ├── open-sans-v17-all-charsets-700italic.woff2
│ ├── open-sans-v17-all-charsets-800.woff2
│ ├── open-sans-v17-all-charsets-800italic.woff2
│ ├── open-sans-v17-all-charsets-italic.woff2
│ ├── open-sans-v17-all-charsets-regular.woff2
│ └── source-code-pro-v11-all-charsets-500.woff2
├── getting-started
│ ├── first-steps.zh.html
│ ├── index.zh.html
│ └── installation.zh.html
├── guide
│ ├── build-cache.zh.html
│ ├── cargo-home.zh.html
│ ├── cargo-toml-vs-cargo-lock.zh.html
│ ├── continuous-integration.zh.html
│ ├── creating-a-new-project.zh.html
│ ├── dependencies.zh.html
│ ├── index.zh.html
│ ├── project-layout.zh.html
│ ├── tests.zh.html
│ ├── why-cargo-exists.zh.html
│ └── working-on-an-existing-project.zh.html
├── highlight.css
├── highlight.js
├── images
│ ├── Cargo-Logo-Small.png
│ ├── auth-level-acl.png
│ ├── forkme.png
│ └── org-level-acl.png
├── index.html
├── index.zh.html
├── mark.min.js
├── print.html
├── reference
│ ├── build-script-examples.zh.html
│ ├── build-scripts.zh.html
│ ├── cargo-targets.zh.html
│ ├── config.zh.html
│ ├── environment-variables.zh.html
│ ├── external-tools.zh.html
│ ├── features-examples.zh.html
│ ├── features.zh.html
│ ├── future-incompat-report.zh.html
│ ├── index.zh.html
│ ├── manifest.zh.html
│ ├── overriding-dependencies.zh.html
│ ├── pkgid-spec.zh.html
│ ├── profiles.zh.html
│ ├── publishing.zh.html
│ ├── registries.zh.html
│ ├── resolver.zh.html
│ ├── semver.zh.html
│ ├── source-replacement.zh.html
│ ├── specifying-dependencies.zh.html
│ ├── unstable.zh.html
│ └── workspaces.zh.html
├── searcher.js
├── searchindex.js
├── searchindex.json
└── tomorrow-night.css
├── en.md
├── readme.md
├── src
├── SUMMARY.en.md
├── SUMMARY.md
├── appendix
│ ├── git-authentication.md
│ ├── git-authentication.zh.md
│ ├── glossary.md
│ └── glossary.zh.md
├── commands
│ ├── build-commands.md
│ ├── build-commands.zh.md
│ ├── cargo-bench.md
│ ├── cargo-bench.zh.md
│ ├── cargo-build.md
│ ├── cargo-build.zh.md
│ ├── cargo-check.md
│ ├── cargo-check.zh.md
│ ├── cargo-clean.md
│ ├── cargo-clean.zh.md
│ ├── cargo-doc.md
│ ├── cargo-doc.zh.md
│ ├── cargo-fetch.md
│ ├── cargo-fetch.zh.md
│ ├── cargo-fix.md
│ ├── cargo-fix.zh.md
│ ├── cargo-generate-lockfile.md
│ ├── cargo-generate-lockfile.zh.md
│ ├── cargo-help.md
│ ├── cargo-help.zh.md
│ ├── cargo-init.md
│ ├── cargo-init.zh.md
│ ├── cargo-install.md
│ ├── cargo-install.zh.md
│ ├── cargo-locate-project.md
│ ├── cargo-locate-project.zh.md
│ ├── cargo-login.md
│ ├── cargo-login.zh.md
│ ├── cargo-metadata.md
│ ├── cargo-metadata.zh.md
│ ├── cargo-new.md
│ ├── cargo-new.zh.md
│ ├── cargo-owner.md
│ ├── cargo-owner.zh.md
│ ├── cargo-package.md
│ ├── cargo-package.zh.md
│ ├── cargo-pkgid.md
│ ├── cargo-pkgid.zh.md
│ ├── cargo-publish.md
│ ├── cargo-publish.zh.md
│ ├── cargo-report.md
│ ├── cargo-report.zh.md
│ ├── cargo-run.md
│ ├── cargo-run.zh.md
│ ├── cargo-rustc.md
│ ├── cargo-rustc.zh.md
│ ├── cargo-rustdoc.md
│ ├── cargo-rustdoc.zh.md
│ ├── cargo-search.md
│ ├── cargo-search.zh.md
│ ├── cargo-test.md
│ ├── cargo-test.zh.md
│ ├── cargo-tree.md
│ ├── cargo-tree.zh.md
│ ├── cargo-uninstall.md
│ ├── cargo-uninstall.zh.md
│ ├── cargo-update.md
│ ├── cargo-update.zh.md
│ ├── cargo-vendor.md
│ ├── cargo-vendor.zh.md
│ ├── cargo-verify-project.md
│ ├── cargo-verify-project.zh.md
│ ├── cargo-version.md
│ ├── cargo-version.zh.md
│ ├── cargo-yank.md
│ ├── cargo-yank.zh.md
│ ├── cargo.md
│ ├── cargo.zh.md
│ ├── general-commands.md
│ ├── general-commands.zh.md
│ ├── index.md
│ ├── index.zh.md
│ ├── manifest-commands.md
│ ├── manifest-commands.zh.md
│ ├── package-commands.md
│ ├── package-commands.zh.md
│ ├── publishing-commands.md
│ └── publishing-commands.zh.md
├── faq.md
├── faq.zh.md
├── favicon.ico
├── getting-started
│ ├── first-steps.md
│ ├── first-steps.zh.md
│ ├── index.md
│ ├── index.zh.md
│ ├── installation.md
│ └── installation.zh.md
├── guide
│ ├── build-cache.md
│ ├── build-cache.zh.md
│ ├── cargo-home.md
│ ├── cargo-home.zh.md
│ ├── cargo-toml-vs-cargo-lock.md
│ ├── cargo-toml-vs-cargo-lock.zh.md
│ ├── continuous-integration.md
│ ├── continuous-integration.zh.md
│ ├── creating-a-new-project.md
│ ├── creating-a-new-project.zh.md
│ ├── dependencies.md
│ ├── dependencies.zh.md
│ ├── index.md
│ ├── index.zh.md
│ ├── project-layout.md
│ ├── project-layout.zh.md
│ ├── tests.md
│ ├── tests.zh.md
│ ├── why-cargo-exists.md
│ ├── why-cargo-exists.zh.md
│ ├── working-on-an-existing-project.md
│ └── working-on-an-existing-project.zh.md
├── images
│ ├── Cargo-Logo-Small.png
│ ├── auth-level-acl.png
│ ├── forkme.png
│ └── org-level-acl.png
├── index.md
├── index.zh.md
└── reference
│ ├── build-script-examples.md
│ ├── build-script-examples.zh.md
│ ├── build-scripts.md
│ ├── build-scripts.zh.md
│ ├── cargo-targets.md
│ ├── cargo-targets.zh.md
│ ├── config.md
│ ├── config.zh.md
│ ├── environment-variables.md
│ ├── environment-variables.zh.md
│ ├── external-tools.md
│ ├── external-tools.zh.md
│ ├── features-examples.md
│ ├── features-examples.zh.md
│ ├── features.md
│ ├── features.zh.md
│ ├── future-incompat-report.md
│ ├── future-incompat-report.zh.md
│ ├── index.md
│ ├── index.zh.md
│ ├── manifest.md
│ ├── manifest.zh.md
│ ├── overriding-dependencies.md
│ ├── overriding-dependencies.zh.md
│ ├── pkgid-spec.md
│ ├── pkgid-spec.zh.md
│ ├── profiles.md
│ ├── profiles.zh.md
│ ├── publishing.md
│ ├── publishing.zh.md
│ ├── registries.md
│ ├── registries.zh.md
│ ├── resolver.md
│ ├── resolver.zh.md
│ ├── semver.md
│ ├── semver.zh.md
│ ├── source-replacement.md
│ ├── source-replacement.zh.md
│ ├── specifying-dependencies.md
│ ├── specifying-dependencies.zh.md
│ ├── unstable.md
│ ├── unstable.zh.md
│ ├── workspaces.md
│ └── workspaces.zh.md
└── sync-en.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | source
2 | hello_world
3 | cargo-source
--------------------------------------------------------------------------------
/.mds-list:
--------------------------------------------------------------------------------
1 | source/src/guide/dependencies.md
2 | source/src/guide/build-cache.md
3 | source/src/guide/project-layout.md
4 | source/src/guide/creating-a-new-project.md
5 | source/src/guide/continuous-integration.md
6 | source/src/guide/working-on-an-existing-project.md
7 | source/src/guide/index.md
8 | source/src/guide/cargo-home.md
9 | source/src/guide/cargo-toml-vs-cargo-lock.md
10 | source/src/guide/why-cargo-exists.md
11 | source/src/guide/tests.md
12 | source/src/getting-started/installation.md
13 | source/src/getting-started/index.md
14 | source/src/getting-started/first-steps.md
15 | source/src/reference/external-tools.md
16 | source/src/reference/future-incompat-report.md
17 | source/src/reference/pkgid-spec.md
18 | source/src/reference/config.md
19 | source/src/reference/overriding-dependencies.md
20 | source/src/reference/features.md
21 | source/src/reference/semver.md
22 | source/src/reference/manifest.md
23 | source/src/reference/profiles.md
24 | source/src/reference/build-scripts.md
25 | source/src/reference/source-replacement.md
26 | source/src/reference/build-script-examples.md
27 | source/src/reference/specifying-dependencies.md
28 | source/src/reference/environment-variables.md
29 | source/src/reference/publishing.md
30 | source/src/reference/unstable.md
31 | source/src/reference/registries.md
32 | source/src/reference/index.md
33 | source/src/reference/features-examples.md
34 | source/src/reference/cargo-targets.md
35 | source/src/reference/workspaces.md
36 | source/src/reference/resolver.md
37 | source/src/faq.md
38 | source/src/appendix/glossary.md
39 | source/src/appendix/git-authentication.md
40 | source/src/index.md
41 | source/src/commands/cargo-run.md
42 | source/src/commands/cargo-clean.md
43 | source/src/commands/cargo-new.md
44 | source/src/commands/cargo-install.md
45 | source/src/commands/cargo-locate-project.md
46 | source/src/commands/cargo-build.md
47 | source/src/commands/manifest-commands.md
48 | source/src/commands/general-commands.md
49 | source/src/commands/cargo-tree.md
50 | source/src/commands/cargo-vendor.md
51 | source/src/commands/build-commands.md
52 | source/src/commands/cargo.md
53 | source/src/commands/cargo-test.md
54 | source/src/commands/cargo-update.md
55 | source/src/commands/cargo-owner.md
56 | source/src/commands/cargo-bench.md
57 | source/src/commands/cargo-metadata.md
58 | source/src/commands/package-commands.md
59 | source/src/commands/publishing-commands.md
60 | source/src/commands/cargo-publish.md
61 | source/src/commands/cargo-help.md
62 | source/src/commands/cargo-fetch.md
63 | source/src/commands/cargo-yank.md
64 | source/src/commands/cargo-rustdoc.md
65 | source/src/commands/cargo-rustc.md
66 | source/src/commands/cargo-uninstall.md
67 | source/src/commands/cargo-generate-lockfile.md
68 | source/src/commands/cargo-pkgid.md
69 | source/src/commands/cargo-report.md
70 | source/src/commands/cargo-fix.md
71 | source/src/commands/cargo-init.md
72 | source/src/commands/index.md
73 | source/src/commands/cargo-check.md
74 | source/src/commands/cargo-search.md
75 | source/src/commands/cargo-verify-project.md
76 | source/src/commands/cargo-doc.md
77 | source/src/commands/cargo-version.md
78 | source/src/commands/cargo-package.md
79 | source/src/commands/cargo-login.md
80 | source/src/SUMMARY.md
81 | source/contrib/src/tests/running.md
82 | source/contrib/src/tests/profiling.md
83 | source/contrib/src/tests/index.md
84 | source/contrib/src/tests/writing.md
85 | source/contrib/src/design.md
86 | source/contrib/src/architecture/console.md
87 | source/contrib/src/architecture/files.md
88 | source/contrib/src/architecture/codebase.md
89 | source/contrib/src/architecture/subcommands.md
90 | source/contrib/src/architecture/compilation.md
91 | source/contrib/src/architecture/packages.md
92 | source/contrib/src/architecture/index.md
93 | source/contrib/src/issues.md
94 | source/contrib/src/process/working-on-cargo.md
95 | source/contrib/src/process/release.md
96 | source/contrib/src/process/unstable.md
97 | source/contrib/src/process/index.md
98 | source/contrib/src/index.md
99 | source/contrib/src/SUMMARY.md
100 | source/contrib/README.md
101 | source/README.md
102 |
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010 The Rust Project Developers
2 |
3 | Permission is hereby granted, free of charge, to any
4 | person obtaining a copy of this software and associated
5 | documentation files (the "Software"), to deal in the
6 | Software without restriction, including without
7 | limitation the rights to use, copy, modify, merge,
8 | publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software
10 | is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice
14 | shall be included in all copies or substantial portions
15 | of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 | DEALINGS IN THE SOFTWARE.
26 |
--------------------------------------------------------------------------------
/book.toml:
--------------------------------------------------------------------------------
1 |
2 | [book]
3 | title = "Rust Cargo 官书(非官方翻译)"
4 | description = "Cargo "
5 | authors = ["Alex Crichton, Steve Klabnik and Carol Nichols, with Contributions from the Rust Community","译文: Yobrave Lee"]
6 | multilingual = false
7 | src = "src"
8 |
9 | [build]
10 | build-dir = "docs"
11 | create-missing = true
12 | use-default-preprocessors = false
13 |
14 | [preprocessor.links]
15 | # renderers = ["html"]
16 |
17 | [output.html]
18 | mathjax-support = false
19 | theme = "theme"
20 | curly-quotes = true
21 | # google-analytics = "UA-128555056-1"
22 | # additional-css = ["theme/custom.css"]
23 | git_repository_url = "https://github.com/chinanf-boy/cargo-book-zh"
24 | git_repository_icon = "fa-github"
25 | edit-url-template = "https://github.com/chinanf-boy/cargo-book-zh/edit/master/{path}"
26 | # additional-js = ["theme/custom.js"]
27 |
28 | [output.html.playpen]
29 | # editor = "./path/to/editor"
30 | editable = false
31 |
32 | [output.html.search]
33 | enable = true
34 | # searcher = "./path/to/searcher"
35 | limit-results = 30
36 | teaser-word-count = 30
37 | use-boolean-and = true
38 | boost-title = 2
39 | boost-hierarchy = 1
40 | boost-paragraph = 1
41 | expand = true
42 | heading-split-level = 3
43 | # copy-js = true
--------------------------------------------------------------------------------
/contrib/README.md:
--------------------------------------------------------------------------------
1 | # Cargo Contributor Guide
2 |
3 | This is the source of the Cargo Contributor Guide, published at
4 | . It is written in Markdown, using
5 | the [mdbook] tool to convert to HTML. If you are editing these pages, the best
6 | option to view the results is to run `mdbook serve`, which will start a web
7 | server on localhost that you can visit to view the book, and it will
8 | automatically reload each time you edit a page.
9 |
10 | This is published via GitHub Actions to GitHub Pages.
11 |
12 | [mdbook]: https://rust-lang.github.io/mdBook/
13 |
--------------------------------------------------------------------------------
/contrib/src/SUMMARY.md:
--------------------------------------------------------------------------------
1 | # Summary
2 |
3 | - [Introduction](./index.md)
4 | - [Issue Tracker](./issues.md)
5 | - [Process](./process/index.md)
6 | - [Working on Cargo](./process/working-on-cargo.md)
7 | - [Release process](./process/release.md)
8 | - [Unstable features](./process/unstable.md)
9 | - [Architecture](./architecture/index.md)
10 | - [Codebase Overview](./architecture/codebase.md)
11 | - [SubCommands](./architecture/subcommands.md)
12 | - [Console Output](./architecture/console.md)
13 | - [Packages and Resolution](./architecture/packages.md)
14 | - [Compilation](./architecture/compilation.md)
15 | - [Files](./architecture/files.md)
16 | - [Tests](./tests/index.md)
17 | - [Running Tests](./tests/running.md)
18 | - [Writing Tests](./tests/writing.md)
19 | - [Benchmarking and Profiling](./tests/profiling.md)
20 | - [Design Principles](./design.md)
21 |
--------------------------------------------------------------------------------
/contrib/src/architecture/compilation.md:
--------------------------------------------------------------------------------
1 | # Compilation
2 |
3 | The [`Unit`] is the primary data structure representing a single execution of
4 | the compiler. It (mostly) contains all the information needed to determine
5 | which flags to pass to the compiler.
6 |
7 | The entry to the compilation process is located in the [`cargo_compile`]
8 | module. The compilation can be conceptually broken into these steps:
9 |
10 | 1. Perform dependency resolution (see [the resolution chapter]).
11 | 2. Generate the root `Unit`s, the things the user requested to compile on the
12 | command-line. This is done in [`generate_targets`].
13 | 3. Starting from the root `Unit`s, generate the [`UnitGraph`] by walking the
14 | dependency graph from the resolver. The `UnitGraph` contains all of the
15 | `Unit` structs, and information about the dependency relationships between
16 | units. This is done in the [`unit_dependencies`] module.
17 | 4. Construct the [`BuildContext`] with all of the information collected so
18 | far. This is the end of the "front end" of compilation.
19 | 5. Create a [`Context`], a large, mutable data structure that coordinates the
20 | compilation process.
21 | 6. The [`Context`] will create a [`JobQueue`], a data structure that tracks
22 | which units need to be built.
23 | 7. [`drain_the_queue`] does the compilation process. This is the only point in
24 | Cargo that currently uses threads.
25 | 8. The result of the compilation is stored in the [`Compilation`] struct. This
26 | can be used for various things, such as running tests after the compilation
27 | has finished.
28 |
29 | [`cargo_compile`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_compile.rs
30 | [`generate_targets`]: https://github.com/rust-lang/cargo/blob/e4b65bdc80f2a293447f2f6a808fa7c84bf9a357/src/cargo/ops/cargo_compile.rs#L725-L739
31 | [`UnitGraph`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/unit_graph.rs
32 | [the resolution chapter]: packages.md
33 | [`Unit`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/unit.rs
34 | [`unit_dependencies`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/unit_dependencies.rs
35 | [`BuildContext`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/build_context/mod.rs
36 | [`Context`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/context/mod.rs
37 | [`JobQueue`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/job_queue.rs
38 | [`drain_the_queue`]: https://github.com/rust-lang/cargo/blob/e4b65bdc80f2a293447f2f6a808fa7c84bf9a357/src/cargo/core/compiler/job_queue.rs#L623-L634
39 | [`Compilation`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/compilation.rs
40 |
--------------------------------------------------------------------------------
/contrib/src/architecture/console.md:
--------------------------------------------------------------------------------
1 | # Console Output
2 |
3 | All of Cargo's output should go through the [`Shell`] struct. You can normally
4 | obtain the `Shell` instance from the [`Config`] struct. Do **not** use the std
5 | `println!` macros.
6 |
7 | Most of Cargo's output goes to stderr. When running in JSON mode, the output
8 | goes to stdout.
9 |
10 | It is important to properly handle errors when writing to the console.
11 | Informational commands, like `cargo list`, should ignore any errors writing
12 | the output. There are some [`drop_print`] macros that are intended to make
13 | this easier.
14 |
15 | Messages written during compilation should handle errors, and abort the build
16 | if they are unable to be displayed. This is generally automatically handled in
17 | the [`JobQueue`] as it processes each message.
18 |
19 | [`Shell`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/shell.rs
20 | [`Config`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/util/config/mod.rs
21 | [`drop_print`]: https://github.com/rust-lang/cargo/blob/e4b65bdc80f2a293447f2f6a808fa7c84bf9a357/src/cargo/util/config/mod.rs#L1820-L1848
22 | [`JobQueue`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/job_queue.rs
23 |
24 | ## Errors
25 |
26 | Cargo uses [`anyhow`] for managing errors. This makes it convenient to "chain"
27 | errors together, so that Cargo can report how an error originated, and what it
28 | was trying to do at the time.
29 |
30 | Error helpers are implemented in the [`errors`] module. Use the
31 | `InternalError` error type for errors that are not expected to happen. This
32 | will print a message to the user to file a bug report.
33 |
34 | The binary side of Cargo uses the `CliError` struct to wrap the process exit
35 | code. Usually Cargo exits with 101 for an error, but some commands like `cargo
36 | test` will exit with different codes.
37 |
38 | [`errors`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/util/errors.rs
39 |
40 | ## Style
41 |
42 | Some guidelines for Cargo's output:
43 |
44 | * Keep the normal output brief. Cargo is already fairly noisy, so try to keep
45 | the output as brief and clean as possible.
46 | * Good error messages are very important! Try to keep them brief and to the
47 | point, but good enough that a beginner can understand what is wrong and can
48 | figure out how to fix. It is a difficult balance to hit! Err on the side of
49 | providing extra information.
50 | * When using any low-level routines, such as `std::fs`, *always* add error
51 | context about what it is doing. For example, reading from a file should
52 | include context about which file is being read if there is an error.
53 | * Cargo's error style is usually a phrase, starting with a lowercase letter.
54 | If there is a longer error message that needs multiple sentences, go ahead
55 | and use multiple sentences. This should probably be improved sometime in the
56 | future to be more structured.
57 |
58 | ## Debug logging
59 |
60 | Cargo uses the [`env_logger`] crate to display debug log messages. The
61 | `CARGO_LOG` environment variable can be set to enable debug logging, with a
62 | value such as `trace`, `debug`, or `warn`. It also supports filtering for
63 | specific modules. Feel free to use the standard [`log`] macros to help with
64 | diagnosing problems.
65 |
66 | ```sh
67 | # Outputs all logs with levels debug and higher
68 | CARGO_LOG=debug cargo generate-lockfile
69 |
70 | # Don't forget that you can filter by module as well
71 | CARGO_LOG=cargo::core::resolver=trace cargo generate-lockfile
72 |
73 | # This will print lots of info about the download process. `trace` prints even more.
74 | CARGO_HTTP_DEBUG=true CARGO_LOG=cargo::ops::registry=debug cargo fetch
75 |
76 | # This is an important command for diagnosing fingerprint issues.
77 | CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build
78 | ```
79 |
80 | [`env_logger`]: https://docs.rs/env_logger
81 | [`log`]: https://docs.rs/log
82 | [`anyhow`]: https://docs.rs/anyhow
83 |
--------------------------------------------------------------------------------
/contrib/src/architecture/files.md:
--------------------------------------------------------------------------------
1 | # Files
2 |
3 | This chapter gives some pointers on where to start looking at Cargo's on-disk
4 | data file structures.
5 |
6 | * [`Layout`] is the abstraction for the `target` directory. It handles locking
7 | the target directory, and providing paths to the parts inside. There is a
8 | separate `Layout` for each "target".
9 | * [`Resolve`] contains the contents of the `Cargo.lock` file. See the [`encode`]
10 | module for the different `Cargo.lock` formats.
11 | * [`TomlManifest`] contains the contents of the `Cargo.toml` file. It is translated
12 | to a [`Manifest`] object for some simplification, and the `Manifest` is stored
13 | in a [`Package`].
14 | * The [`fingerprint`] module deals with the fingerprint information stored in
15 | `target/debug/.fingerprint`. This tracks whether or not a crate needs to be
16 | rebuilt.
17 | * `cargo install` tracks its installed files with some metadata in
18 | `$CARGO_HOME`. The metadata is managed in the
19 | [`common_for_install_and_uninstall`] module.
20 | * Git sources are cached in `$CARGO_HOME/git`. The code for this cache is in
21 | the [`git`] source module.
22 | * Registries are cached in `$CARGO_HOME/registry`. There are three parts, the
23 | index, the compressed `.crate` files, and the extracted sources of those
24 | crate files.
25 | * Management of the registry cache can be found in the [`registry`] source
26 | module. Note that this includes an on-disk cache as an optimization for
27 | accessing the git repository.
28 | * Saving of `.crate` files is handled by the [`RemoteRegistry`].
29 | * Extraction of `.crate` files is handled by the [`RegistrySource`].
30 | * There is a lock for the package cache. Code must be careful, because
31 | this lock must be obtained manually. See
32 | [`Config::acquire_package_cache_lock`].
33 |
34 | [`Layout`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/layout.rs
35 | [`Resolve`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/resolver/resolve.rs
36 | [`encode`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/resolver/encode.rs
37 | [`TomlManifest`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/util/toml/mod.rs
38 | [`Manifest`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/manifest.rs
39 | [`Package`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/package.rs
40 | [`common_for_install_and_uninstall`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/common_for_install_and_uninstall.rs
41 | [`git`]: https://github.com/rust-lang/cargo/tree/master/src/cargo/sources/git
42 | [`registry`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/sources/registry/mod.rs
43 | [`RemoteRegistry`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/sources/registry/remote.rs
44 | [`RegistrySource`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/sources/registry/mod.rs
45 | [`Config::acquire_package_cache_lock`]: https://github.com/rust-lang/cargo/blob/e4b65bdc80f2a293447f2f6a808fa7c84bf9a357/src/cargo/util/config/mod.rs#L1261-L1266
46 |
47 | ## Filesystems
48 |
49 | Cargo tends to get run on a very wide array of file systems. Different file
50 | systems can have a wide range of capabilities, and Cargo should strive to do
51 | its best to handle them. Some examples of issues to deal with:
52 |
53 | * Not all file systems support locking. Cargo tries to detect if locking is
54 | supported, and if not, will ignore lock errors. This isn't ideal, but it is
55 | difficult to deal with.
56 | * The [`fs::canonicalize`] function doesn't work on all file systems
57 | (particularly some Windows file systems). If that function is used, there
58 | should be a fallback if it fails. This function will also return `\\?\`
59 | style paths on Windows, which can have some issues (such as some tools not
60 | supporting them, or having issues with relative paths).
61 | * Timestamps can be unreliable. The [`fingerprint`] module has a deeper
62 | discussion of this. One example is that Docker cache layers will erase the
63 | fractional part of the time stamp.
64 | * Symlinks are not always supported, particularly on Windows.
65 |
66 | [`fingerprint`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/fingerprint.rs
67 | [`fs::canonicalize`]: https://doc.rust-lang.org/std/fs/fn.canonicalize.html
68 |
--------------------------------------------------------------------------------
/contrib/src/architecture/index.md:
--------------------------------------------------------------------------------
1 | # Architecture Overview
2 |
3 | This chapter gives a very high-level overview of Cargo's architecture. This is
4 | intended to give you links into the code which is hopefully commented with
5 | more in-depth information.
6 |
7 | If you feel something is missing that would help you, feel free to ask on
8 | Zulip.
9 |
--------------------------------------------------------------------------------
/contrib/src/architecture/subcommands.md:
--------------------------------------------------------------------------------
1 | # SubCommands
2 |
3 | Cargo is a single binary composed of a set of [`clap`] subcommands. All
4 | subcommands live in [`src/bin/cargo/commands`] directory.
5 | [`src/bin/cargo/main.rs`] is the entry point.
6 |
7 | Each subcommand, such as [`src/bin/cargo/commands/build.rs`], usually performs
8 | the following:
9 |
10 | 1. Parse the CLI flags. See the [`command_prelude`] module for some helpers to make this easier.
11 | 2. Load the config files.
12 | 3. Discover and load the workspace.
13 | 4. Calls the actual implementation of the subcommand which resides in [`src/cargo/ops`].
14 |
15 | If the subcommand is not found in the built-in list, then Cargo will
16 | automatically search for a subcommand named `cargo-{NAME}` in the users `PATH`
17 | to execute the subcommand.
18 |
19 |
20 | [`clap`]: https://clap.rs/
21 | [`src/bin/cargo/commands/build.rs`]: https://github.com/rust-lang/cargo/tree/master/src/bin/cargo/commands/build.rs
22 | [`src/cargo/ops`]: https://github.com/rust-lang/cargo/tree/master/src/cargo/ops
23 | [`src/bin/cargo/commands`]: https://github.com/rust-lang/cargo/tree/master/src/bin/cargo/commands
24 | [`src/bin/cargo/main.rs`]: https://github.com/rust-lang/cargo/blob/master/src/bin/cargo/main.rs
25 | [`command_prelude`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/util/command_prelude.rs
26 |
--------------------------------------------------------------------------------
/contrib/src/index.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | Thank you for your interest in contributing to [Cargo]! This guide provides an
4 | overview of how to contribute to Cargo, how to dive into the code, and how the
5 | testing infrastructure works.
6 |
7 | There are many ways to contribute, such as [helping other users], [filing
8 | issues], [improving the documentation], [fixing bugs], and working on [small]
9 | and [large features].
10 |
11 | If you have a general question about Cargo or its internals, feel free to ask
12 | on [Zulip].
13 |
14 | This guide assumes you have some familiarity with Rust, and how to use Cargo,
15 | [rustup], and general development tools like [git].
16 |
17 | Please also read the [Rust Code of Conduct].
18 |
19 | [Cargo]: https://doc.rust-lang.org/cargo/
20 | [Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo
21 | [Rust Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct
22 | [helping other users]: https://users.rust-lang.org/
23 | [filing issues]: issues.md
24 | [rustup]: https://rust-lang.github.io/rustup/
25 | [git]: https://git-scm.com/
26 | [improving the documentation]: https://github.com/rust-lang/cargo/tree/master/src/doc
27 | [fixing bugs]: process/index.md#working-on-small-bugs
28 | [small]: process/index.md#working-on-small-features
29 | [large features]: process/index.md#working-on-large-features
30 |
--------------------------------------------------------------------------------
/contrib/src/process/unstable.md:
--------------------------------------------------------------------------------
1 | # Unstable features
2 |
3 | Most new features should go through the unstable process. This means that the
4 | feature will only be usable on the nightly channel, and requires a specific
5 | opt-in by the user. Small changes can skip this process, but please consult
6 | with the Cargo team first.
7 |
8 | ## Unstable feature opt-in
9 |
10 | For features that require behavior changes or new syntax in `Cargo.toml`, then
11 | it will need a `cargo-features` value placed at the top of `Cargo.toml` to
12 | enable it. The process for doing adding a new feature is described in the
13 | [`features` module]. Code that implements the feature will need to manually
14 | check that the feature is enabled for the current manifest.
15 |
16 | For features that add new command-line flags, config options, or environment
17 | variables, then the `-Z` flags will be needed to enable them. The [`features`
18 | module] also describes how to add these. New flags should use the
19 | `fail_if_stable_opt` method to check if the `-Z unstable-options` flag has
20 | been passed.
21 |
22 | ## Unstable documentation
23 |
24 | Every unstable feature should have a section added to the [unstable chapter]
25 | describing how to use the feature.
26 |
27 | `-Z` CLI flags should be documented in the built-in help in the [`cli`
28 | module].
29 |
30 | [unstable chapter]: https://github.com/rust-lang/cargo/blob/master/src/doc/src/reference/unstable.md
31 | [`cli` module]: https://github.com/rust-lang/cargo/blob/master/src/bin/cargo/cli.rs
32 |
33 | ## Tracking issues
34 |
35 | Each unstable feature should get a [tracking issue]. These issues are
36 | typically created when a PR is close to being merged, or soon after it is
37 | merged. Use the [tracking issue template] when creating a tracking issue.
38 |
39 | Larger features should also get a new label in the issue tracker so that when
40 | issues are filed, they can be easily tied together.
41 |
42 | [tracking issue]: https://github.com/rust-lang/cargo/labels/C-tracking-issue
43 | [tracking issue template]: https://github.com/rust-lang/cargo/issues/new?labels=C-tracking-issue&template=tracking_issue.md
44 |
45 | ## Stabilization
46 |
47 | After some period of time, typically measured in months, the feature can be
48 | considered to be stabilized. The feature should not have any significant known
49 | bugs or issues, and any design concerns should be resolved.
50 |
51 | The stabilization process depends on the kind of feature. For smaller
52 | features, you can leave a comment on the tracking issue expressing interest in
53 | stabilizing it. It can usually help to indicate that the feature has received
54 | some real-world testing, and has exhibited some demand for broad use.
55 |
56 | For larger features that have not gone through the [RFC process], then an RFC
57 | to call for stabilization might be warranted. This gives the community a final
58 | chance to provide feedback about the proposed design.
59 |
60 | For a small feature, or one that has already gone through the RFC process, a
61 | Cargo Team member may decide to call for a "final comment period" using
62 | [rfcbot]. This is a public signal that a major change is being made, and gives
63 | the Cargo Team members an opportunity to confirm or block the change. This
64 | process can take a few days or weeks, or longer if a concern is raised.
65 |
66 | Once the stabilization has been approved, the person who called for
67 | stabilization should prepare a PR to stabilize the feature. This PR should:
68 |
69 | * Flip the feature to stable in the [`features` module].
70 | * Remove any unstable checks that aren't automatically handled by the feature
71 | system.
72 | * Move the documentation from the [unstable chapter] into the appropriate
73 | places in the Cargo book and man pages.
74 | * Remove the `-Z` flags and help message if applicable.
75 | * Update all tests to remove nightly checks.
76 | * Tag the PR with [relnotes] label if it seems important enough to highlight
77 | in the [Rust release notes].
78 |
79 | [`features` module]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/features.rs
80 | [RFC process]: https://github.com/rust-lang/rfcs/
81 | [rfcbot]: https://github.com/rust-lang/rfcbot-rs
82 | [Rust release notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md
83 | [relnotes]: https://github.com/rust-lang/cargo/issues?q=label%3Arelnotes
84 |
--------------------------------------------------------------------------------
/contrib/src/tests/index.md:
--------------------------------------------------------------------------------
1 | # Tests
2 |
3 | Cargo has an extensive test suite. Most of it is implemented as integration
4 | tests in the [`testsuite`] directory. There are several other tests:
5 |
6 | * Unit tests are scattered throughout.
7 | * The dependency resolver has its own set of tests in the [`resolver-tests`]
8 | directory.
9 | * All of the packages in the [`crates`] directory have their own set of tests.
10 | * The [`build-std`] test is for the [build-std feature]. It is separate since
11 | it has some special requirements.
12 | * Documentation has a variety of tests, such as link validation, and the
13 | [SemVer chapter validity checks].
14 |
15 | [`testsuite`]: https://github.com/rust-lang/cargo/tree/master/tests/testsuite/
16 | [`resolver-tests`]: https://github.com/rust-lang/cargo/tree/master/crates/resolver-tests
17 | [`crates`]: https://github.com/rust-lang/cargo/tree/master/crates
18 | [`build-std`]: https://github.com/rust-lang/cargo/blob/master/tests/build-std/main.rs
19 | [build-std feature]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std
20 | [SemVer chapter validity checks]: https://github.com/rust-lang/cargo/tree/master/src/doc/semver-check
21 |
--------------------------------------------------------------------------------
/contrib/src/tests/profiling.md:
--------------------------------------------------------------------------------
1 | # Benchmarking and Profiling
2 |
3 | ## Internal profiler
4 |
5 | Cargo has a basic, hierarchical profiler built-in. The environment variable
6 | `CARGO_PROFILE` can be set to an integer which specifies how deep in the
7 | profile stack to print results for.
8 |
9 | ```sh
10 | # Output first three levels of profiling info
11 | CARGO_PROFILE=3 cargo generate-lockfile
12 | ```
13 |
14 | ## Benchmarking
15 |
16 | ### Benchsuite
17 |
18 | Head over to the [`benches`
19 | directory](https://github.com/rust-lang/cargo/tree/master/benches) for more
20 | information about the benchmarking suite.
21 |
22 | ### Informal benchmarking
23 |
24 | The overhead for starting a build should be kept as low as possible
25 | (preferably, well under 0.5 seconds on most projects and systems). Currently,
26 | the primary parts that affect this are:
27 |
28 | * Running the resolver.
29 | * Querying the index.
30 | * Checking git dependencies.
31 | * Scanning the local project.
32 | * Building the unit dependency graph.
33 |
34 | One way to test this is to use [hyperfine]. This is a tool that can be used to
35 | measure the difference between different commands and settings. Usually this
36 | is done by measuring the time it takes for `cargo build` to finish in a large
37 | project where the build is fresh (no actual compilation is performed). Just
38 | run `cargo build` once before using hyperfine.
39 |
40 | [hyperfine]: https://github.com/sharkdp/hyperfine
41 |
--------------------------------------------------------------------------------
/contrib/src/tests/running.md:
--------------------------------------------------------------------------------
1 | # Running Tests
2 |
3 | Using `cargo test` is usually sufficient for running the full test suite. This
4 | can take a few minutes, so you may want to use more targeted flags to pick the
5 | specific test you want to run, such as `cargo test --test testsuite
6 | -- check::check_success`.
7 |
8 | ## Running nightly tests
9 |
10 | Some tests only run on the nightly toolchain, and will be ignored on other
11 | channels. It is recommended that you run tests with both nightly and stable to
12 | ensure everything is working as expected.
13 |
14 | Some of the nightly tests require the `rustc-dev` and `llvm-tools-preview`
15 | rustup components installed. These components include the compiler as a
16 | library. This may already be installed with your nightly toolchain, but if it
17 | isn't, run `rustup component add rustc-dev llvm-tools-preview
18 | --toolchain=nightly`.
19 |
20 | ## Running cross tests
21 |
22 | Some tests exercise cross compiling to a different target. This will require
23 | you to install the appropriate target. This typically is the 32-bit target of
24 | your host platform. For example, if your host is a 64-bit
25 | `x86_64-unknown-linux-gnu`, then you should install the 32-bit target with
26 | `rustup target add i686-unknown-linux-gnu`. If you don't have the alternate
27 | target installed, there should be an error message telling you what to do. You
28 | may also need to install additional tools for the target. For example, on Ubuntu
29 | you should install the `gcc-multilib` package.
30 |
31 | If you can't install an alternate target, you can set the
32 | `CFG_DISABLE_CROSS_TESTS=1` environment variable to disable these tests. The
33 | Windows cross tests only support the MSVC toolchain.
34 |
35 | ## Running build-std tests
36 |
37 | The `build-std` tests are disabled by default, but you can run them by setting
38 | the `CARGO_RUN_BUILD_STD_TESTS=1` environment variable and running `cargo test
39 | --test build-std`. This requires the nightly channel, and also requires the
40 | `rust-src` component installed with `rustup component add rust-src
41 | --toolchain=nightly`.
42 |
--------------------------------------------------------------------------------
/docs/.nojekyll:
--------------------------------------------------------------------------------
1 | This file makes sure that Github Pages doesn't process mdBook's output.
2 |
--------------------------------------------------------------------------------
/docs/FontAwesome/fonts/FontAwesome.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/FontAwesome/fonts/FontAwesome.ttf
--------------------------------------------------------------------------------
/docs/FontAwesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/FontAwesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/docs/FontAwesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/FontAwesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/docs/FontAwesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/FontAwesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/docs/FontAwesome/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/FontAwesome/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/docs/ayu-highlight.css:
--------------------------------------------------------------------------------
1 | /*
2 | Based off of the Ayu theme
3 | Original by Dempfi (https://github.com/dempfi/ayu)
4 | */
5 |
6 | .hljs {
7 | display: block;
8 | overflow-x: auto;
9 | background: #191f26;
10 | color: #e6e1cf;
11 | padding: 0.5em;
12 | }
13 |
14 | .hljs-comment,
15 | .hljs-quote {
16 | color: #5c6773;
17 | font-style: italic;
18 | }
19 |
20 | .hljs-variable,
21 | .hljs-template-variable,
22 | .hljs-attribute,
23 | .hljs-attr,
24 | .hljs-regexp,
25 | .hljs-link,
26 | .hljs-selector-id,
27 | .hljs-selector-class {
28 | color: #ff7733;
29 | }
30 |
31 | .hljs-number,
32 | .hljs-meta,
33 | .hljs-builtin-name,
34 | .hljs-literal,
35 | .hljs-type,
36 | .hljs-params {
37 | color: #ffee99;
38 | }
39 |
40 | .hljs-string,
41 | .hljs-bullet {
42 | color: #b8cc52;
43 | }
44 |
45 | .hljs-title,
46 | .hljs-built_in,
47 | .hljs-section {
48 | color: #ffb454;
49 | }
50 |
51 | .hljs-keyword,
52 | .hljs-selector-tag,
53 | .hljs-symbol {
54 | color: #ff7733;
55 | }
56 |
57 | .hljs-name {
58 | color: #36a3d9;
59 | }
60 |
61 | .hljs-tag {
62 | color: #00568d;
63 | }
64 |
65 | .hljs-emphasis {
66 | font-style: italic;
67 | }
68 |
69 | .hljs-strong {
70 | font-weight: bold;
71 | }
72 |
73 | .hljs-addition {
74 | color: #91b362;
75 | }
76 |
77 | .hljs-deletion {
78 | color: #d96c75;
79 | }
80 |
--------------------------------------------------------------------------------
/docs/css/general.css:
--------------------------------------------------------------------------------
1 | /* Base styles and content styles */
2 |
3 | @import 'variables.css';
4 |
5 | :root {
6 | /* Browser default font-size is 16px, this way 1 rem = 10px */
7 | font-size: 62.5%;
8 | }
9 |
10 | html {
11 | font-family: "Open Sans", sans-serif;
12 | color: var(--fg);
13 | background-color: var(--bg);
14 | text-size-adjust: none;
15 | -webkit-text-size-adjust: none;
16 | }
17 |
18 | body {
19 | margin: 0;
20 | font-size: 1.6rem;
21 | overflow-x: hidden;
22 | }
23 |
24 | code {
25 | font-family: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace !important;
26 | font-size: 0.875em; /* please adjust the ace font size accordingly in editor.js */
27 | }
28 |
29 | /* Don't change font size in headers. */
30 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
31 | font-size: unset;
32 | }
33 |
34 | .left { float: left; }
35 | .right { float: right; }
36 | .boring { opacity: 0.6; }
37 | .hide-boring .boring { display: none; }
38 | .hidden { display: none !important; }
39 |
40 | h2, h3 { margin-top: 2.5em; }
41 | h4, h5 { margin-top: 2em; }
42 |
43 | .header + .header h3,
44 | .header + .header h4,
45 | .header + .header h5 {
46 | margin-top: 1em;
47 | }
48 |
49 | h1:target::before,
50 | h2:target::before,
51 | h3:target::before,
52 | h4:target::before,
53 | h5:target::before,
54 | h6:target::before {
55 | display: inline-block;
56 | content: "»";
57 | margin-left: -30px;
58 | width: 30px;
59 | }
60 |
61 | /* This is broken on Safari as of version 14, but is fixed
62 | in Safari Technology Preview 117 which I think will be Safari 14.2.
63 | https://bugs.webkit.org/show_bug.cgi?id=218076
64 | */
65 | :target {
66 | scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
67 | }
68 |
69 | .page {
70 | outline: 0;
71 | padding: 0 var(--page-padding);
72 | margin-top: calc(0px - var(--menu-bar-height)); /* Compensate for the #menu-bar-hover-placeholder */
73 | }
74 | .page-wrapper {
75 | box-sizing: border-box;
76 | }
77 | .js:not(.sidebar-resizing) .page-wrapper {
78 | transition: margin-left 0.3s ease, transform 0.3s ease; /* Animation: slide away */
79 | }
80 |
81 | .content {
82 | overflow-y: auto;
83 | padding: 0 15px;
84 | padding-bottom: 50px;
85 | }
86 | .content main {
87 | margin-left: auto;
88 | margin-right: auto;
89 | max-width: var(--content-max-width);
90 | }
91 | .content p { line-height: 1.45em; }
92 | .content ol { line-height: 1.45em; }
93 | .content ul { line-height: 1.45em; }
94 | .content a { text-decoration: none; }
95 | .content a:hover { text-decoration: underline; }
96 | .content img, .content video { max-width: 100%; }
97 | .content .header:link,
98 | .content .header:visited {
99 | color: var(--fg);
100 | }
101 | .content .header:link,
102 | .content .header:visited:hover {
103 | text-decoration: none;
104 | }
105 |
106 | table {
107 | margin: 0 auto;
108 | border-collapse: collapse;
109 | }
110 | table td {
111 | padding: 3px 20px;
112 | border: 1px var(--table-border-color) solid;
113 | }
114 | table thead {
115 | background: var(--table-header-bg);
116 | }
117 | table thead td {
118 | font-weight: 700;
119 | border: none;
120 | }
121 | table thead th {
122 | padding: 3px 20px;
123 | }
124 | table thead tr {
125 | border: 1px var(--table-header-bg) solid;
126 | }
127 | /* Alternate background colors for rows */
128 | table tbody tr:nth-child(2n) {
129 | background: var(--table-alternate-bg);
130 | }
131 |
132 |
133 | blockquote {
134 | margin: 20px 0;
135 | padding: 0 20px;
136 | color: var(--fg);
137 | background-color: var(--quote-bg);
138 | border-top: .1em solid var(--quote-border);
139 | border-bottom: .1em solid var(--quote-border);
140 | }
141 |
142 |
143 | :not(.footnote-definition) + .footnote-definition,
144 | .footnote-definition + :not(.footnote-definition) {
145 | margin-top: 2em;
146 | }
147 | .footnote-definition {
148 | font-size: 0.9em;
149 | margin: 0.5em 0;
150 | }
151 | .footnote-definition p {
152 | display: inline;
153 | }
154 |
155 | .tooltiptext {
156 | position: absolute;
157 | visibility: hidden;
158 | color: #fff;
159 | background-color: #333;
160 | transform: translateX(-50%); /* Center by moving tooltip 50% of its width left */
161 | left: -8px; /* Half of the width of the icon */
162 | top: -35px;
163 | font-size: 0.8em;
164 | text-align: center;
165 | border-radius: 6px;
166 | padding: 5px 8px;
167 | margin: 5px;
168 | z-index: 1000;
169 | }
170 | .tooltipped .tooltiptext {
171 | visibility: visible;
172 | }
173 |
174 | .chapter li.part-title {
175 | color: var(--sidebar-fg);
176 | margin: 5px 0px;
177 | font-weight: bold;
178 | }
179 |
180 | .result-no-output {
181 | font-style: italic;
182 | }
183 |
--------------------------------------------------------------------------------
/docs/css/print.css:
--------------------------------------------------------------------------------
1 |
2 | #sidebar,
3 | #menu-bar,
4 | .nav-chapters,
5 | .mobile-nav-chapters {
6 | display: none;
7 | }
8 |
9 | #page-wrapper.page-wrapper {
10 | transform: none;
11 | margin-left: 0px;
12 | overflow-y: initial;
13 | }
14 |
15 | #content {
16 | max-width: none;
17 | margin: 0;
18 | padding: 0;
19 | }
20 |
21 | .page {
22 | overflow-y: initial;
23 | }
24 |
25 | code {
26 | background-color: #666666;
27 | border-radius: 5px;
28 |
29 | /* Force background to be printed in Chrome */
30 | -webkit-print-color-adjust: exact;
31 | }
32 |
33 | pre > .buttons {
34 | z-index: 2;
35 | }
36 |
37 | a, a:visited, a:active, a:hover {
38 | color: #4183c4;
39 | text-decoration: none;
40 | }
41 |
42 | h1, h2, h3, h4, h5, h6 {
43 | page-break-inside: avoid;
44 | page-break-after: avoid;
45 | }
46 |
47 | pre, code {
48 | page-break-inside: avoid;
49 | white-space: pre-wrap;
50 | }
51 |
52 | .fa {
53 | display: none !important;
54 | }
55 |
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/favicon.ico
--------------------------------------------------------------------------------
/docs/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/favicon.png
--------------------------------------------------------------------------------
/docs/favicon.svg:
--------------------------------------------------------------------------------
1 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/fonts/SOURCE-CODE-PRO-LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 | This license is copied below, and is also available with a FAQ at:
5 | http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/docs/fonts/fonts.css:
--------------------------------------------------------------------------------
1 | /* Open Sans is licensed under the Apache License, Version 2.0. See http://www.apache.org/licenses/LICENSE-2.0 */
2 | /* Source Code Pro is under the Open Font License. See https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL */
3 |
4 | /* open-sans-300 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
5 | @font-face {
6 | font-family: 'Open Sans';
7 | font-style: normal;
8 | font-weight: 300;
9 | src: local('Open Sans Light'), local('OpenSans-Light'),
10 | url('open-sans-v17-all-charsets-300.woff2') format('woff2');
11 | }
12 |
13 | /* open-sans-300italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
14 | @font-face {
15 | font-family: 'Open Sans';
16 | font-style: italic;
17 | font-weight: 300;
18 | src: local('Open Sans Light Italic'), local('OpenSans-LightItalic'),
19 | url('open-sans-v17-all-charsets-300italic.woff2') format('woff2');
20 | }
21 |
22 | /* open-sans-regular - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
23 | @font-face {
24 | font-family: 'Open Sans';
25 | font-style: normal;
26 | font-weight: 400;
27 | src: local('Open Sans Regular'), local('OpenSans-Regular'),
28 | url('open-sans-v17-all-charsets-regular.woff2') format('woff2');
29 | }
30 |
31 | /* open-sans-italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
32 | @font-face {
33 | font-family: 'Open Sans';
34 | font-style: italic;
35 | font-weight: 400;
36 | src: local('Open Sans Italic'), local('OpenSans-Italic'),
37 | url('open-sans-v17-all-charsets-italic.woff2') format('woff2');
38 | }
39 |
40 | /* open-sans-600 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
41 | @font-face {
42 | font-family: 'Open Sans';
43 | font-style: normal;
44 | font-weight: 600;
45 | src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
46 | url('open-sans-v17-all-charsets-600.woff2') format('woff2');
47 | }
48 |
49 | /* open-sans-600italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
50 | @font-face {
51 | font-family: 'Open Sans';
52 | font-style: italic;
53 | font-weight: 600;
54 | src: local('Open Sans SemiBold Italic'), local('OpenSans-SemiBoldItalic'),
55 | url('open-sans-v17-all-charsets-600italic.woff2') format('woff2');
56 | }
57 |
58 | /* open-sans-700 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
59 | @font-face {
60 | font-family: 'Open Sans';
61 | font-style: normal;
62 | font-weight: 700;
63 | src: local('Open Sans Bold'), local('OpenSans-Bold'),
64 | url('open-sans-v17-all-charsets-700.woff2') format('woff2');
65 | }
66 |
67 | /* open-sans-700italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
68 | @font-face {
69 | font-family: 'Open Sans';
70 | font-style: italic;
71 | font-weight: 700;
72 | src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'),
73 | url('open-sans-v17-all-charsets-700italic.woff2') format('woff2');
74 | }
75 |
76 | /* open-sans-800 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
77 | @font-face {
78 | font-family: 'Open Sans';
79 | font-style: normal;
80 | font-weight: 800;
81 | src: local('Open Sans ExtraBold'), local('OpenSans-ExtraBold'),
82 | url('open-sans-v17-all-charsets-800.woff2') format('woff2');
83 | }
84 |
85 | /* open-sans-800italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
86 | @font-face {
87 | font-family: 'Open Sans';
88 | font-style: italic;
89 | font-weight: 800;
90 | src: local('Open Sans ExtraBold Italic'), local('OpenSans-ExtraBoldItalic'),
91 | url('open-sans-v17-all-charsets-800italic.woff2') format('woff2');
92 | }
93 |
94 | /* source-code-pro-500 - latin_vietnamese_latin-ext_greek_cyrillic-ext_cyrillic */
95 | @font-face {
96 | font-family: 'Source Code Pro';
97 | font-style: normal;
98 | font-weight: 500;
99 | src: url('source-code-pro-v11-all-charsets-500.woff2') format('woff2');
100 | }
101 |
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-300.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-300.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-300italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-300italic.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-600.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-600.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-600italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-600italic.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-700.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-700.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-700italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-700italic.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-800.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-800.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-800italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-800italic.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-italic.woff2
--------------------------------------------------------------------------------
/docs/fonts/open-sans-v17-all-charsets-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/open-sans-v17-all-charsets-regular.woff2
--------------------------------------------------------------------------------
/docs/fonts/source-code-pro-v11-all-charsets-500.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/fonts/source-code-pro-v11-all-charsets-500.woff2
--------------------------------------------------------------------------------
/docs/highlight.css:
--------------------------------------------------------------------------------
1 | /*
2 | * An increased contrast highlighting scheme loosely based on the
3 | * "Base16 Atelier Dune Light" theme by Bram de Haan
4 | * (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)
5 | * Original Base16 color scheme by Chris Kempson
6 | * (https://github.com/chriskempson/base16)
7 | */
8 |
9 | /* Comment */
10 | .hljs-comment,
11 | .hljs-quote {
12 | color: #575757;
13 | }
14 |
15 | /* Red */
16 | .hljs-variable,
17 | .hljs-template-variable,
18 | .hljs-attribute,
19 | .hljs-tag,
20 | .hljs-name,
21 | .hljs-regexp,
22 | .hljs-link,
23 | .hljs-name,
24 | .hljs-selector-id,
25 | .hljs-selector-class {
26 | color: #d70025;
27 | }
28 |
29 | /* Orange */
30 | .hljs-number,
31 | .hljs-meta,
32 | .hljs-built_in,
33 | .hljs-builtin-name,
34 | .hljs-literal,
35 | .hljs-type,
36 | .hljs-params {
37 | color: #b21e00;
38 | }
39 |
40 | /* Green */
41 | .hljs-string,
42 | .hljs-symbol,
43 | .hljs-bullet {
44 | color: #008200;
45 | }
46 |
47 | /* Blue */
48 | .hljs-title,
49 | .hljs-section {
50 | color: #0030f2;
51 | }
52 |
53 | /* Purple */
54 | .hljs-keyword,
55 | .hljs-selector-tag {
56 | color: #9d00ec;
57 | }
58 |
59 | .hljs {
60 | display: block;
61 | overflow-x: auto;
62 | background: #f6f7f6;
63 | color: #000;
64 | padding: 0.5em;
65 | }
66 |
67 | .hljs-emphasis {
68 | font-style: italic;
69 | }
70 |
71 | .hljs-strong {
72 | font-weight: bold;
73 | }
74 |
75 | .hljs-addition {
76 | color: #22863a;
77 | background-color: #f0fff4;
78 | }
79 |
80 | .hljs-deletion {
81 | color: #b31d28;
82 | background-color: #ffeef0;
83 | }
84 |
--------------------------------------------------------------------------------
/docs/images/Cargo-Logo-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/images/Cargo-Logo-Small.png
--------------------------------------------------------------------------------
/docs/images/auth-level-acl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/images/auth-level-acl.png
--------------------------------------------------------------------------------
/docs/images/forkme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/images/forkme.png
--------------------------------------------------------------------------------
/docs/images/org-level-acl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chinanf-boy/cargo-book-zh/a89f26b2599c52d4362ab76721233fc6d4a4f9fd/docs/images/org-level-acl.png
--------------------------------------------------------------------------------
/docs/tomorrow-night.css:
--------------------------------------------------------------------------------
1 | /* Tomorrow Night Theme */
2 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
3 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */
4 | /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
5 |
6 | /* Tomorrow Comment */
7 | .hljs-comment {
8 | color: #969896;
9 | }
10 |
11 | /* Tomorrow Red */
12 | .hljs-variable,
13 | .hljs-attribute,
14 | .hljs-tag,
15 | .hljs-regexp,
16 | .ruby .hljs-constant,
17 | .xml .hljs-tag .hljs-title,
18 | .xml .hljs-pi,
19 | .xml .hljs-doctype,
20 | .html .hljs-doctype,
21 | .css .hljs-id,
22 | .css .hljs-class,
23 | .css .hljs-pseudo {
24 | color: #cc6666;
25 | }
26 |
27 | /* Tomorrow Orange */
28 | .hljs-number,
29 | .hljs-preprocessor,
30 | .hljs-pragma,
31 | .hljs-built_in,
32 | .hljs-literal,
33 | .hljs-params,
34 | .hljs-constant {
35 | color: #de935f;
36 | }
37 |
38 | /* Tomorrow Yellow */
39 | .ruby .hljs-class .hljs-title,
40 | .css .hljs-rule .hljs-attribute {
41 | color: #f0c674;
42 | }
43 |
44 | /* Tomorrow Green */
45 | .hljs-string,
46 | .hljs-value,
47 | .hljs-inheritance,
48 | .hljs-header,
49 | .hljs-name,
50 | .ruby .hljs-symbol,
51 | .xml .hljs-cdata {
52 | color: #b5bd68;
53 | }
54 |
55 | /* Tomorrow Aqua */
56 | .hljs-title,
57 | .css .hljs-hexcolor {
58 | color: #8abeb7;
59 | }
60 |
61 | /* Tomorrow Blue */
62 | .hljs-function,
63 | .python .hljs-decorator,
64 | .python .hljs-title,
65 | .ruby .hljs-function .hljs-title,
66 | .ruby .hljs-title .hljs-keyword,
67 | .perl .hljs-sub,
68 | .javascript .hljs-title,
69 | .coffeescript .hljs-title {
70 | color: #81a2be;
71 | }
72 |
73 | /* Tomorrow Purple */
74 | .hljs-keyword,
75 | .javascript .hljs-function {
76 | color: #b294bb;
77 | }
78 |
79 | .hljs {
80 | display: block;
81 | overflow-x: auto;
82 | background: #1d1f21;
83 | color: #c5c8c6;
84 | padding: 0.5em;
85 | -webkit-text-size-adjust: none;
86 | }
87 |
88 | .coffeescript .javascript,
89 | .javascript .xml,
90 | .tex .hljs-formula,
91 | .xml .javascript,
92 | .xml .vbscript,
93 | .xml .css,
94 | .xml .hljs-cdata {
95 | opacity: 0.5;
96 | }
97 |
98 | .hljs-addition {
99 | color: #718c00;
100 | }
101 |
102 | .hljs-deletion {
103 | color: #c82829;
104 | }
105 |
--------------------------------------------------------------------------------
/en.md:
--------------------------------------------------------------------------------
1 | # Cargo
2 |
3 | Cargo downloads your Rust project’s dependencies and compiles your project.
4 |
5 | Learn more at https://doc.rust-lang.org/cargo/
6 |
7 | ## Code Status
8 |
9 | [](https://dev.azure.com/rust-lang/cargo/_build?definitionId=18)
10 |
11 | Code documentation: https://docs.rs/cargo/
12 |
13 | ## Installing Cargo
14 |
15 | Cargo is distributed by default with Rust, so if you've got `rustc` installed
16 | locally you probably also have `cargo` installed locally.
17 |
18 | ## Compiling from Source
19 |
20 | Cargo requires the following tools and packages to build:
21 |
22 | * `git`
23 | * `curl` (on Unix)
24 | * `pkg-config` (on Unix, used to figure out the `libssl` headers/libraries)
25 | * OpenSSL headers (only for Unix, this is the `libssl-dev` package on ubuntu)
26 | * `cargo` and `rustc`
27 |
28 | First, you'll want to check out this repository
29 |
30 | ```
31 | git clone https://github.com/rust-lang/cargo
32 | cd cargo
33 | ```
34 |
35 | With `cargo` already installed, you can simply run:
36 |
37 | ```
38 | cargo build --release
39 | ```
40 |
41 | ## Adding new subcommands to Cargo
42 |
43 | Cargo is designed to be extensible with new subcommands without having to modify
44 | Cargo itself. See [the Wiki page][third-party-subcommands] for more details and
45 | a list of known community-developed subcommands.
46 |
47 | [third-party-subcommands]: https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands
48 |
49 |
50 | ## Releases
51 |
52 | Cargo releases coincide with Rust releases.
53 | High level release notes are available as part of [Rust's release notes][rel].
54 | Detailed release notes are available in this repo at [CHANGELOG.md].
55 |
56 | [rel]: https://github.com/rust-lang/rust/blob/master/RELEASES.md
57 | [CHANGELOG.md]: CHANGELOG.md
58 |
59 | ## Reporting issues
60 |
61 | Found a bug? We'd love to know about it!
62 |
63 | Please report all issues on the GitHub [issue tracker][issues].
64 |
65 | [issues]: https://github.com/rust-lang/cargo/issues
66 |
67 | ## Contributing
68 |
69 | See the **[Cargo Contributor Guide]** for a complete introduction
70 | to contributing to Cargo.
71 |
72 | [Cargo Contributor Guide]: https://rust-lang.github.io/cargo/contrib/
73 |
74 | ## License
75 |
76 | Cargo is primarily distributed under the terms of both the MIT license
77 | and the Apache License (Version 2.0).
78 |
79 | See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.
80 |
81 | ### Third party software
82 |
83 | This product includes software developed by the OpenSSL Project
84 | for use in the OpenSSL Toolkit (https://www.openssl.org/).
85 |
86 | In binary form, this product includes software that is licensed under the
87 | terms of the GNU General Public License, version 2, with a linking exception,
88 | which can be obtained from the [upstream repository][1].
89 |
90 | See [LICENSE-THIRD-PARTY](LICENSE-THIRD-PARTY) for details.
91 |
92 | [1]: https://github.com/libgit2/libgit2
93 |
94 |
--------------------------------------------------------------------------------
/src/SUMMARY.en.md:
--------------------------------------------------------------------------------
1 | # Summary
2 |
3 | [Introduction](index.md)
4 |
5 | * [Getting Started](getting-started/index.md)
6 | * [Installation](getting-started/installation.md)
7 | * [First Steps with Cargo](getting-started/first-steps.md)
8 |
9 | * [Cargo Guide](guide/index.md)
10 | * [Why Cargo Exists](guide/why-cargo-exists.md)
11 | * [Creating a New Package](guide/creating-a-new-project.md)
12 | * [Working on an Existing Package](guide/working-on-an-existing-project.md)
13 | * [Dependencies](guide/dependencies.md)
14 | * [Package Layout](guide/project-layout.md)
15 | * [Cargo.toml vs Cargo.lock](guide/cargo-toml-vs-cargo-lock.md)
16 | * [Tests](guide/tests.md)
17 | * [Continuous Integration](guide/continuous-integration.md)
18 | * [Cargo Home](guide/cargo-home.md)
19 | * [Build Cache](guide/build-cache.md)
20 |
21 | * [Cargo Reference](reference/index.md)
22 | * [Specifying Dependencies](reference/specifying-dependencies.md)
23 | * [Overriding Dependencies](reference/overriding-dependencies.md)
24 | * [The Manifest Format](reference/manifest.md)
25 | * [Cargo Targets](reference/cargo-targets.md)
26 | * [Workspaces](reference/workspaces.md)
27 | * [Features](reference/features.md)
28 | * [Features Examples](reference/features-examples.md)
29 | * [Profiles](reference/profiles.md)
30 | * [Configuration](reference/config.md)
31 | * [Environment Variables](reference/environment-variables.md)
32 | * [Build Scripts](reference/build-scripts.md)
33 | * [Build Script Examples](reference/build-script-examples.md)
34 | * [Publishing on crates.io](reference/publishing.md)
35 | * [Package ID Specifications](reference/pkgid-spec.md)
36 | * [Source Replacement](reference/source-replacement.md)
37 | * [External Tools](reference/external-tools.md)
38 | * [Registries](reference/registries.md)
39 | * [Dependency Resolution](reference/resolver.md)
40 | * [SemVer Compatibility](reference/semver.md)
41 | * [Future incompat report](reference/future-incompat-report.md)
42 | * [Unstable Features](reference/unstable.md)
43 |
44 | * [Cargo Commands](commands/index.md)
45 | * [General Commands](commands/general-commands.md)
46 | * [cargo](commands/cargo.md)
47 | * [cargo help](commands/cargo-help.md)
48 | * [cargo version](commands/cargo-version.md)
49 | * [Build Commands](commands/build-commands.md)
50 | * [cargo bench](commands/cargo-bench.md)
51 | * [cargo build](commands/cargo-build.md)
52 | * [cargo check](commands/cargo-check.md)
53 | * [cargo clean](commands/cargo-clean.md)
54 | * [cargo doc](commands/cargo-doc.md)
55 | * [cargo fetch](commands/cargo-fetch.md)
56 | * [cargo fix](commands/cargo-fix.md)
57 | * [cargo run](commands/cargo-run.md)
58 | * [cargo rustc](commands/cargo-rustc.md)
59 | * [cargo rustdoc](commands/cargo-rustdoc.md)
60 | * [cargo test](commands/cargo-test.md)
61 | * [cargo report](commands/cargo-report.md)
62 | * [Manifest Commands](commands/manifest-commands.md)
63 | * [cargo generate-lockfile](commands/cargo-generate-lockfile.md)
64 | * [cargo locate-project](commands/cargo-locate-project.md)
65 | * [cargo metadata](commands/cargo-metadata.md)
66 | * [cargo pkgid](commands/cargo-pkgid.md)
67 | * [cargo tree](commands/cargo-tree.md)
68 | * [cargo update](commands/cargo-update.md)
69 | * [cargo vendor](commands/cargo-vendor.md)
70 | * [cargo verify-project](commands/cargo-verify-project.md)
71 | * [Package Commands](commands/package-commands.md)
72 | * [cargo init](commands/cargo-init.md)
73 | * [cargo install](commands/cargo-install.md)
74 | * [cargo new](commands/cargo-new.md)
75 | * [cargo search](commands/cargo-search.md)
76 | * [cargo uninstall](commands/cargo-uninstall.md)
77 | * [Publishing Commands](commands/publishing-commands.md)
78 | * [cargo login](commands/cargo-login.md)
79 | * [cargo owner](commands/cargo-owner.md)
80 | * [cargo package](commands/cargo-package.md)
81 | * [cargo publish](commands/cargo-publish.md)
82 | * [cargo yank](commands/cargo-yank.md)
83 |
84 | * [FAQ](faq.md)
85 | * [Appendix: Glossary](appendix/glossary.md)
86 | * [Appendix: Git Authentication](appendix/git-authentication.md)
87 |
--------------------------------------------------------------------------------
/src/SUMMARY.md:
--------------------------------------------------------------------------------
1 | # Summary
2 |
3 | [Introduction](index.zh.md)
4 |
5 | * [Getting Started](getting-started/index.zh.md)
6 | * [Installation](getting-started/installation.zh.md)
7 | * [First Steps with Cargo](getting-started/first-steps.zh.md)
8 |
9 | * [Cargo Guide](guide/index.zh.md)
10 | * [Why Cargo Exists](guide/why-cargo-exists.zh.md)
11 | * [Creating a New Package](guide/creating-a-new-project.zh.md)
12 | * [Working on an Existing Package](guide/working-on-an-existing-project.zh.md)
13 | * [Dependencies](guide/dependencies.zh.md)
14 | * [Package Layout](guide/project-layout.zh.md)
15 | * [Cargo.toml vs Cargo.lock](guide/cargo-toml-vs-cargo-lock.zh.md)
16 | * [Tests](guide/tests.zh.md)
17 | * [Continuous Integration](guide/continuous-integration.zh.md)
18 | * [Cargo Home](guide/cargo-home.zh.md)
19 | * [Build Cache](guide/build-cache.zh.md)
20 |
21 | * [Cargo Reference](reference/index.zh.md)
22 | * [Specifying Dependencies](reference/specifying-dependencies.zh.md)
23 | * [Overriding Dependencies](reference/overriding-dependencies.zh.md)
24 | * [The Manifest Format](reference/manifest.zh.md)
25 | * [Cargo Targets](reference/cargo-targets.zh.md)
26 | * [Workspaces](reference/workspaces.zh.md)
27 | * [Features](reference/features.zh.md)
28 | * [Features Examples](reference/features-examples.zh.md)
29 | * [Profiles](reference/profiles.zh.md)
30 | * [Configuration](reference/config.zh.md)
31 | * [Environment Variables](reference/environment-variables.zh.md)
32 | * [Build Scripts](reference/build-scripts.zh.md)
33 | * [Build Script Examples](reference/build-script-examples.zh.md)
34 | * [Publishing on crates.io](reference/publishing.zh.md)
35 | * [Package ID Specifications](reference/pkgid-spec.zh.md)
36 | * [Source Replacement](reference/source-replacement.zh.md)
37 | * [External Tools](reference/external-tools.zh.md)
38 | * [Registries](reference/registries.zh.md)
39 | * [Dependency Resolution](reference/resolver.zh.md)
40 | * [SemVer Compatibility](reference/semver.zh.md)
41 | * [Future incompat report](reference/future-incompat-report.zh.md)
42 | * [Unstable Features](reference/unstable.zh.md)
43 |
44 | * [Cargo Commands](commands/index.zh.md)
45 | * [General Commands](commands/general-commands.zh.md)
46 | * [cargo](commands/cargo.zh.md)
47 | * [cargo help](commands/cargo-help.zh.md)
48 | * [cargo version](commands/cargo-version.zh.md)
49 | * [Build Commands](commands/build-commands.zh.md)
50 | * [cargo bench](commands/cargo-bench.zh.md)
51 | * [cargo build](commands/cargo-build.zh.md)
52 | * [cargo check](commands/cargo-check.zh.md)
53 | * [cargo clean](commands/cargo-clean.zh.md)
54 | * [cargo doc](commands/cargo-doc.zh.md)
55 | * [cargo fetch](commands/cargo-fetch.zh.md)
56 | * [cargo fix](commands/cargo-fix.zh.md)
57 | * [cargo run](commands/cargo-run.zh.md)
58 | * [cargo rustc](commands/cargo-rustc.zh.md)
59 | * [cargo rustdoc](commands/cargo-rustdoc.zh.md)
60 | * [cargo test](commands/cargo-test.zh.md)
61 | * [cargo report](commands/cargo-report.zh.md)
62 | * [Manifest Commands](commands/manifest-commands.zh.md)
63 | * [cargo generate-lockfile](commands/cargo-generate-lockfile.zh.md)
64 | * [cargo locate-project](commands/cargo-locate-project.zh.md)
65 | * [cargo metadata](commands/cargo-metadata.zh.md)
66 | * [cargo pkgid](commands/cargo-pkgid.zh.md)
67 | * [cargo tree](commands/cargo-tree.zh.md)
68 | * [cargo update](commands/cargo-update.zh.md)
69 | * [cargo vendor](commands/cargo-vendor.zh.md)
70 | * [cargo verify-project](commands/cargo-verify-project.zh.md)
71 | * [Package Commands](commands/package-commands.zh.md)
72 | * [cargo init](commands/cargo-init.zh.md)
73 | * [cargo install](commands/cargo-install.zh.md)
74 | * [cargo new](commands/cargo-new.zh.md)
75 | * [cargo search](commands/cargo-search.zh.md)
76 | * [cargo uninstall](commands/cargo-uninstall.zh.md)
77 | * [Publishing Commands](commands/publishing-commands.zh.md)
78 | * [cargo login](commands/cargo-login.zh.md)
79 | * [cargo owner](commands/cargo-owner.zh.md)
80 | * [cargo package](commands/cargo-package.zh.md)
81 | * [cargo publish](commands/cargo-publish.zh.md)
82 | * [cargo yank](commands/cargo-yank.zh.md)
83 |
84 | * [FAQ](faq.zh.md)
85 | * [Appendix: Glossary](appendix/glossary.zh.md)
86 | * [Appendix: Git Authentication](appendix/git-authentication.zh.md)
87 |
--------------------------------------------------------------------------------
/src/appendix/git-authentication.md:
--------------------------------------------------------------------------------
1 | # Git Authentication
2 |
3 | Cargo supports some forms of authentication when using git dependencies and
4 | registries. This appendix contains some information for setting up git
5 | authentication in a way that works with Cargo.
6 |
7 | If you need other authentication methods, the [`net.git-fetch-with-cli`]
8 | config value can be set to cause Cargo to execute the `git` executable to
9 | handle fetching remote repositories instead of using the built-in support.
10 | This can be enabled with the `CARGO_NET_GIT_FETCH_WITH_CLI=true` environment
11 | variable.
12 |
13 | ## HTTPS authentication
14 |
15 | HTTPS authentication requires the [`credential.helper`] mechanism. There are
16 | multiple credential helpers, and you specify the one you want to use in your
17 | global git configuration file.
18 |
19 | ```ini
20 | # ~/.gitconfig
21 |
22 | [credential]
23 | helper = store
24 | ```
25 |
26 | Cargo does not ask for passwords, so for most helpers you will need to give
27 | the helper the initial username/password before running Cargo. One way to do
28 | this is to run `git clone` of the private git repo and enter the
29 | username/password.
30 |
31 | > **Tip:**
32 | > macOS users may want to consider using the osxkeychain helper.
33 | > Windows users may want to consider using the [GCM] helper.
34 |
35 | > **Note:** Windows users will need to make sure that the `sh` shell is
36 | > available in your `PATH`. This typically is available with the Git for
37 | > Windows installation.
38 |
39 | ## SSH authentication
40 |
41 | SSH authentication requires `ssh-agent` to be running to acquire the SSH key.
42 | Make sure the appropriate environment variables are set up (`SSH_AUTH_SOCK` on
43 | most Unix-like systems), and that the correct keys are added (with `ssh-add`).
44 |
45 | Windows can use Pageant (part of [PuTTY]) or `ssh-agent`.
46 | To use `ssh-agent`, Cargo needs to use the OpenSSH that is distributed as part
47 | of Windows, as Cargo does not support the simulated Unix-domain sockets used
48 | by MinGW or Cygwin.
49 | More information about installing with Windows can be found at the [Microsoft
50 | installation documentation] and the page on [key management] has instructions
51 | on how to start `ssh-agent` and to add keys.
52 |
53 | > **Note:** Cargo does not support git's shorthand SSH URLs like
54 | > `git@example.com:user/repo.git`. Use a full SSH URL like
55 | > `ssh://git@example.com/user/repo.git`.
56 |
57 | > **Note:** SSH configuration files (like OpenSSH's `~/.ssh/config`) are not
58 | > used by Cargo's built-in SSH library. More advanced requirements should use
59 | > [`net.git-fetch-with-cli`].
60 |
61 | [`credential.helper`]: https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
62 | [`net.git-fetch-with-cli`]: ../reference/config.md#netgit-fetch-with-cli
63 | [GCM]: https://github.com/microsoft/Git-Credential-Manager-Core/
64 | [PuTTY]: https://www.chiark.greenend.org.uk/~sgtatham/putty/
65 | [Microsoft installation documentation]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
66 | [key management]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement
67 |
--------------------------------------------------------------------------------
/src/appendix/git-authentication.zh.md:
--------------------------------------------------------------------------------
1 | # Git Authentication
2 |
3 | Cargo在使用git依赖项和注册表时支持某些形式的身份验证。本附录包含一些信息,用于以与Cargo兼容的方式设置git身份验证。
4 |
5 | 如果需要其他身份验证方法,则[`net.git-fetch-with-cli`]配置值可以设置为使Cargo执行`git`用于处理获取远程存储库的可执行文件,而不是使用内置支持。这可以通过`CARGO_NET_GIT_FETCH_WITH_CLI=true`环境变量。
6 |
7 | ## HTTPS authentication
8 |
9 | HTTPS身份验证需要[`credential.helper`]机械装置有多个凭证帮助程序,您可以指定要在全局git配置文件中使用的凭证帮助程序。
10 |
11 | ```ini
12 | # ~/.gitconfig
13 |
14 | [credential]
15 | helper = store
16 | ```
17 |
18 | Cargo不要求输入密码,因此对于大多数助手,在运行Cargo之前,您需要为助手提供初始用户名/密码。一种方法是跑步`git clone`输入用户名/密码。
19 |
20 | > **提示:** MACOS用户可能想考虑使用OXKEY链助手。 Windows用户可能想考虑使用[GCM]帮手
21 | >
22 | > **注:**Windows用户需要确保`sh`shell在您的`PATH`。这通常在Git for Windows安装中提供。
23 |
24 | ## SSH authentication
25 |
26 | SSH身份验证需要`ssh-agent`正在运行以获取SSH密钥。确保设置了适当的环境变量(`SSH_AUTH_SOCK`在大多数类似Unix的系统上),并且添加了正确的密钥(使用`ssh-add`).
27 |
28 | Windows可以使用Pageant(部分功能)[PuTTY])或者`ssh-agent`.使用`ssh-agent`,Cargo需要使用作为Windows一部分分发的OpenSSH,因为Cargo不支持MinGW或Cygwin使用的模拟Unix域套接字。有关Windows安装的更多信息,请访问[Microsoft
29 | installation documentation]这一页[key management]有关于如何开始的说明`ssh-agent`以及添加密钥。
30 |
31 | > **注:**Cargo不支持git的简写SSH URL,比如`git@example.com:user/repo.git`.使用完整的SSH URL,如`ssh://git@example.com/user/repo.git`.
32 | >
33 | > **注:**SSH配置文件(如OpenSSH)`~/.ssh/config`)Cargo的内置SSH库不使用。应该使用更高级的需求[`net.git-fetch-with-cli`].
34 |
35 | [`credential.helper`]: https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
36 |
37 | [`net.git-fetch-with-cli`]: ../reference/config.md#netgit-fetch-with-cli
38 |
39 | [gcm]: https://github.com/microsoft/Git-Credential-Manager-Core/
40 |
41 | [putty]: https://www.chiark.greenend.org.uk/~sgtatham/putty/
42 |
43 | [microsoft installation documentation]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
44 |
45 | [key management]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement
46 |
--------------------------------------------------------------------------------
/src/appendix/glossary.zh.md:
--------------------------------------------------------------------------------
1 | # Glossary
2 |
3 | - 词汇表
4 |
5 | ### Artifact
6 |
7 | - 工件
8 |
9 | 一个*Artifact*是由编译过程创建的文件或文件集。这包括可链接库和可执行二进制文件.
10 |
11 | ### Crate
12 |
13 | - 箱 (包/库, 又一抽象名)
14 |
15 | 包中的每个目标都是*箱*。Crates 是库或可执行二进制文件。它可能松散地引用目标的源代码或目标生成的编译工件。一个箱也可以指从注册表中提取的压缩包.
16 |
17 | ### Edition
18 |
19 | - 版本
20 |
21 | 一个*Rust Edition*是 Rust 语言的开发里程碑。该[一个包的版本][edition-field]在`Cargo.toml`清单中指定,各个目标可以指定它们使用的版本。见[版本指南][edition guide]欲获得更多信息.
22 |
23 | ### Feature
24 |
25 | - 特性/特征/功能
26 |
27 | 一个[_特征_][feature]是一个允许条件编译的命名标志参数。一个特性可以引用可选的依赖项,或者在 一个`Cargo.toml` 中定义的任意名称,可以键入(使用到)源代码中。
28 |
29 | Cargo 有[_不稳定的特征标志_][cargo-unstable],这可以用来实现 Cargo 本身的实验行为。Rust 编译器和 Rustdoc 也有自己的不稳定特征标志(参见[不稳定的书][unstable-book]和[Rustdoc 书][rustdoc-unstable]).
30 |
31 | ### Index
32 |
33 | - 索引是注册表中,可搜索的包的列表.
34 |
35 | ### Lock file
36 |
37 | - (锁定/锁) 文件
38 |
39 | `Cargo.lock`,名:_锁定文件_,是一个文件,用于捕获工作空间或包中使用的每个依赖项的确切版本,它由 Cargo 自动生成。看到[Cargo.toml 与 Cargo.lock][cargo.toml vs cargo.lock].
40 |
41 | ### Manifest
42 |
43 | - 清单/元信息
44 |
45 | 一个[_清单_][manifest]是对包或工作空间的描述,名为`Cargo.toml`.
46 |
47 | 一个[_虚拟清单_][virtual]是一个`Cargo.toml`,仅描述工作空间的文件,不包含包。
48 |
49 | ### Member
50 |
51 | - 会员/成员
52 |
53 | 一个*成员*是属于工作空间的一个包.
54 |
55 | ### Package
56 |
57 | - 包
58 |
59 | 一个*包*是源文件和描述包的清单`Cargo.toml`的集合。包具有名称和版本,用于指定包之间的依赖关系。包中包含多个目标,这些目标是库或可执行二进制文件。
60 |
61 | 该*包根*是`Cargo.toml`清单位于的包的目录。
62 |
63 | 该[_包 ID 规范_][pkgid-spec], 要么*SPEC*,是一个字符串,用于辨识从特定源,引用特定版本的包唯一性。
64 |
65 | ### Project
66 |
67 | - 包/项目
68 |
69 | [package](#package)的另一个名字.
70 |
71 | ### Registry
72 |
73 | - 注册表
74 |
75 | 一个*注册处*是一种服务,包含可下载的包,可以安装或用作包的依赖项.默认注册表是[crates.io](https://crates.io)。注册表有一个*索引*,其中包含所有包装箱的清单,并告诉 Cargo 如何下载所需的箱。
76 |
77 | ### Source
78 |
79 | - 源/资源
80 |
81 | 一个*源*是一个提供程序,包含箱子,这些箱子可当依赖项的包。有几种源:
82 |
83 | - **注册表来源**- 见[注册表](#registry).
84 | - **本地注册表源**- 在文件系统上存储为压缩文件的一组包。看到[本地注册表来源][local registry sources].
85 | - **目录来源**- 在文件系统上存储为未压缩文件的一组包.看到[目录来源][directory sources].
86 | - **路径来源**- 位于文件系统上的单个包(例如[路径依赖][path dependency])或一组多个包(如[路径覆盖][path overrides]).
87 | - **Git 来源**- 位于 git 存储库中的包(例如[git 依赖][git dependency]要么[git 来源][git source]).
88 |
89 | 看到[来源更换][source replacement]欲获得更多信息.
90 |
91 | ### Spec
92 |
93 | - 看到[包 ID 规范](#package).
94 |
95 | ### Target
96 |
97 | - 目标
98 |
99 | *Target*这个词的意思,取决于具体情况:
100 |
101 | - **Cargo 目标** - Cargo 项目会有*target*,其具有对应将要生成的工件。项目可以包含库,二进制,示例,测试和基准目标。该[目标列表][targets]配置在`Cargo.toml`清单,通常由源文件的[目录布局][directory layout]自动推断的。
102 | - **目标架构**- 构建工件的 OS 和机器体系结构,通常称为一个*目标*。
103 | - **目标 三元(Triple)**- 三元组是用于指定目标体系结构的特定格式。见[clang 文档][clang documentation] 了解详情。三元组可以称为 一个*目标三元*,此为产生的工件的架构,以及*主机三元*,此为编译器运行的体系结构。可以使用`--target`命令行选项或`build.target` [配置选项]指定目标三元组。
104 | - **目标目录**- Cargo 将所有构建的工件和中间文件放入*target*目录。默认情况下,这是一个名为`target`的目录会在工作区根目录,或者包根(如果不使用工作空间)。目录随着`--target-dir`命令行选项,`CARGO_TARGET_DIR` [环境变量][environment variable], 或者`build.target-dir`
105 | [配置选项][config option]改变而改变.
106 |
107 |
108 | > “target-triple (目标 三元)" 是 编译器的 专用术语,用 “ cpu- vendor- os" 来标识 交叉编译时的 系统类型
109 |
110 | ### Test Targets
111 |
112 | Cargo*测试目标*生成二进制文件,帮助验证代码的正确操作和正确性。有两种类型的测试工件:
113 |
114 | - **单元测试**- 一个*单元测试*是直接从库或二进制目标编译的可执行二进制文件。它包含库或二进制代码的全部内容,并运行`#[test]`注释函数,用于验证各个代码单元。
115 | - **集成测试目标**- 一个[_集成测试目标_][integration-tests]是一个来自*测试目标*的可执行的二进制文件,这是一个独特的箱子,其来源位于`tests`目录或由在`Cargo.toml`清单里面的[`[[test]]`表][targets]指定。它旨在仅测试库的公共 API,或执行二进制文件以验证其操作。
116 |
117 | ### Workspace
118 |
119 | - 工作区
120 |
121 | 一个[_工作区_][workspace]是一个共享公共依赖项解析(具有共享`Cargo.lock`),输出目录和各种设置,如配置文件,的一个或多个包的集合。
122 |
123 | 一个[_虚拟工作区_][virtual]是`Cargo.toml`清单根目录的工作空间, 没有定义包,只列出工作区成员。
124 |
125 | 该*工作区根*是工作区的`Cargo.toml`清单位于的目录.
126 |
127 | [cargo.toml vs cargo.lock]: ../cargo-toml-vs-cargo-lock.zh.md
128 | [directory sources]: ../reference/source-replacement.zh.md#directory-sources
129 | [local registry sources]: ../reference/source-replacement.zh.md#local-registry-sources
130 | [source replacement]: ../reference/source-replacement.zh.md
131 | [cargo-unstable]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.zh.md
132 | [clang documentation]: http://clang.llvm.org/docs/CrossCompilation.zh.md#target-triple
133 | [config option]: ../reference/config.zh.md
134 | [directory layout]: ../reference/manifest.zh.md#the-project-layout
135 | [edition guide]: https://rust-lang-nursery.github.io/edition-guide/
136 | [edition-field]: ../reference/manifest.zh.md#the-edition-field-optional
137 | [environment variable]: ../reference/environment-variables.zh.md
138 | [feature]: ../reference/manifest.zh.md#the-features-section
139 | [git dependency]: ../reference/specifying-dependencies.zh.md#specifying-dependencies-from-git-repositories
140 | [git source]: ../reference/source-replacement.zh.md
141 | [integration-tests]: ../reference/manifest.zh.md#integration-tests
142 | [manifest]: ../reference/manifest.zh.md
143 | [path dependency]: ../reference/specifying-dependencies.zh.md#specifying-path-dependencies
144 | [path overrides]: ../reference/specifying-dependencies.zh.md#overriding-with-local-dependencies
145 | [pkgid-spec]: ../reference/pkgid-spec.zh.md
146 | [rustdoc-unstable]: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.zh.md
147 | [targets]: ../reference/manifest.zh.md#configuring-a-target
148 | [unstable-book]: https://doc.rust-lang.org/nightly/unstable-book/index.zh.md
149 | [virtual]: ../reference/manifest.zh.md#virtual-manifest
150 | [workspace]: ../reference/manifest.zh.md#the-workspace-section
151 |
--------------------------------------------------------------------------------
/src/commands/build-commands.md:
--------------------------------------------------------------------------------
1 | # Build Commands
2 | * [cargo bench](cargo-bench.md)
3 | * [cargo build](cargo-build.md)
4 | * [cargo check](cargo-check.md)
5 | * [cargo clean](cargo-clean.md)
6 | * [cargo doc](cargo-doc.md)
7 | * [cargo fetch](cargo-fetch.md)
8 | * [cargo fix](cargo-fix.md)
9 | * [cargo run](cargo-run.md)
10 | * [cargo rustc](cargo-rustc.md)
11 | * [cargo rustdoc](cargo-rustdoc.md)
12 | * [cargo test](cargo-test.md)
13 | * [cargo report](cargo-report.md)
14 |
--------------------------------------------------------------------------------
/src/commands/build-commands.zh.md:
--------------------------------------------------------------------------------
1 | # Build Commands
2 |
3 | - [cargo bench](cargo-bench.zh.md)
4 | - [cargo build](cargo-build.zh.md)
5 | - [cargo check](cargo-check.zh.md)
6 | - [cargo clean](cargo-clean.zh.md)
7 | - [cargo doc](cargo-doc.zh.md)
8 | - [cargo fetch](cargo-fetch.zh.md)
9 | - [cargo fix](cargo-fix.zh.md)
10 | - [cargo run](cargo-run.zh.md)
11 | - [cargo rustc](cargo-rustc.zh.md)
12 | - [cargo rustdoc](cargo-rustdoc.zh.md)
13 | - [cargo test](cargo-test.zh.md)
14 | - [cargo report](cargo-report.zh.md)
15 |
--------------------------------------------------------------------------------
/src/commands/cargo-help.md:
--------------------------------------------------------------------------------
1 | # cargo-help(1)
2 |
3 | ## NAME
4 |
5 | cargo-help - Get help for a Cargo command
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo help` [_subcommand_]
10 |
11 | ## DESCRIPTION
12 |
13 | Prints a help message for the given command.
14 |
15 | ## EXAMPLES
16 |
17 | 1. Get help for a command:
18 |
19 | cargo help build
20 |
21 | 2. Help is also available with the `--help` flag:
22 |
23 | cargo build --help
24 |
25 | ## SEE ALSO
26 | [cargo(1)](cargo.zh.md)
27 |
--------------------------------------------------------------------------------
/src/commands/cargo-help.zh.md:
--------------------------------------------------------------------------------
1 | # cargo-help(1)
2 |
3 | ## NAME
4 |
5 | Cargo-help - 获得 Cargo 帮助信息
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo help` [_subcommand_]
10 |
11 | ## DESCRIPTION
12 |
13 | 打印给定命令的帮助消息。
14 |
15 | ## EXAMPLES
16 |
17 | 1. 获取命令帮助:
18 |
19 | ```bash
20 | cargo help build
21 | ```
22 |
23 | 2. 也可以通过`--help`选项:
24 |
25 | ```bash
26 | cargo build --help
27 | ```
28 |
29 | ## SEE ALSO
30 |
31 | [cargo(1)](cargo.zh.md)
32 |
--------------------------------------------------------------------------------
/src/commands/cargo-locate-project.md:
--------------------------------------------------------------------------------
1 | # cargo-locate-project(1)
2 |
3 | ## NAME
4 |
5 | cargo-locate-project - Print a JSON representation of a Cargo.toml file's location
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo locate-project` [_options_]
10 |
11 | ## DESCRIPTION
12 |
13 | This command will print a JSON object to stdout with the full path to the
14 | `Cargo.toml` manifest.
15 |
16 | ## OPTIONS
17 |
18 |
19 |
20 |
--workspace
21 |
Locate the Cargo.toml at the root of the workspace, as opposed to the current
22 | workspace member.
23 |
24 |
25 |
26 |
27 | ### Display Options
28 |
29 |
30 |
31 |
--message-formatfmt
32 |
The representation in which to print the project location. Valid values:
33 |
34 |
json (default): JSON object with the path under the key "root".
35 |
plain: Just the path.
36 |
37 |
38 |
39 |
-v
40 |
--verbose
41 |
Use verbose output. May be specified twice for "very verbose" output which
42 | includes extra output such as dependency warnings and build script output.
43 | May also be specified with the term.verbose
44 | config value.
45 |
46 |
47 |
-q
48 |
--quiet
49 |
Do not print cargo log messages.
50 | May also be specified with the term.quiet
51 | config value.
52 |
53 |
54 |
--colorwhen
55 |
Control when colored output is used. Valid values:
56 |
57 |
auto (default): Automatically detect if color support is available on the
58 | terminal.
59 |
always: Always display colors.
60 |
never: Never display colors.
61 |
62 |
May also be specified with the term.color
63 | config value.
64 |
65 |
66 |
67 |
68 | ### Manifest Options
69 |
70 |
71 |
--manifest-pathpath
72 |
Path to the Cargo.toml file. By default, Cargo searches for the
73 | Cargo.toml file in the current directory or any parent directory.
74 |
75 |
76 |
77 |
78 | ### Common Options
79 |
80 |
81 |
82 |
+toolchain
83 |
If Cargo has been installed with rustup, and the first argument to cargo
84 | begins with +, it will be interpreted as a rustup toolchain name (such
85 | as +stable or +nightly).
86 | See the rustup documentation
87 | for more information about how toolchain overrides work.
88 |
89 |
90 |
-h
91 |
--help
92 |
Prints help information.
93 |
94 |
95 |
-Zflag
96 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
97 |
98 |
99 |
100 |
101 |
102 | ## ENVIRONMENT
103 |
104 | See [the reference](../reference/environment-variables.html) for
105 | details on environment variables that Cargo reads.
106 |
107 |
108 | ## EXIT STATUS
109 |
110 | * `0`: Cargo succeeded.
111 | * `101`: Cargo failed to complete.
112 |
113 |
114 | ## EXAMPLES
115 |
116 | 1. Display the path to the manifest based on the current directory:
117 |
118 | cargo locate-project
119 |
120 | ## SEE ALSO
121 | [cargo(1)](cargo.zh.md), [cargo-metadata(1)](cargo-metadata.html)
122 |
--------------------------------------------------------------------------------
/src/commands/cargo-locate-project.zh.md:
--------------------------------------------------------------------------------
1 | # cargo-locate-project(1)
2 |
3 | ## NAME
4 |
5 | cargo locate项目——打印Cargo的JSON表示。toml文件的位置
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo locate-project` [_options_]
10 |
11 | ## DESCRIPTION
12 |
13 | 这个命令将把一个JSON对象打印到stdout,并带有到`Cargo.toml`显示
14 |
15 | ## OPTIONS
16 |
17 |
18 |
19 |
--workspace
20 |
Locate the Cargo.toml at the root of the workspace, as opposed to the current
21 | workspace member.
22 |
23 |
24 |
25 | ### Display Options
26 |
27 |
28 |
29 |
--message-formatfmt
30 |
The representation in which to print the project location. Valid values:
31 |
32 |
json (default): JSON object with the path under the key "root".
33 |
plain: Just the path.
34 |
35 |
36 |
-v
37 |
--verbose
38 |
Use verbose output. May be specified twice for "very verbose" output which
39 | includes extra output such as dependency warnings and build script output.
40 | May also be specified with the term.verbose
41 | config value.
42 |
43 |
-q
44 |
--quiet
45 |
Do not print cargo log messages.
46 | May also be specified with the term.quiet
47 | config value.
48 |
49 |
--colorwhen
50 |
Control when colored output is used. Valid values:
51 |
52 |
auto (default): Automatically detect if color support is available on the
53 | terminal.
54 |
always: Always display colors.
55 |
never: Never display colors.
56 |
57 |
May also be specified with the term.color
58 | config value.
59 |
60 |
61 |
62 | ### Manifest Options
63 |
64 |
65 |
--manifest-pathpath
66 |
Path to the Cargo.toml file. By default, Cargo searches for the
67 | Cargo.toml file in the current directory or any parent directory.
68 |
69 |
70 |
71 | ### Common Options
72 |
73 |
74 |
75 |
+toolchain
76 |
If Cargo has been installed with rustup, and the first argument to cargo
77 | begins with +, it will be interpreted as a rustup toolchain name (such
78 | as +stable or +nightly).
79 | See the rustup documentation
80 | for more information about how toolchain overrides work.
81 |
82 |
-h
83 |
--help
84 |
Prints help information.
85 |
86 |
-Zflag
87 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
88 |
89 |
90 |
91 | ## ENVIRONMENT
92 |
93 | 查看[the reference](../reference/environment-variables.html)有关Cargo读取的环境变量的详细信息。
94 |
95 | ## EXIT STATUS
96 |
97 | - `0`:Cargo成功。
98 | - `101`:Cargo未能完成。
99 |
100 | ## EXAMPLES
101 |
102 | 1. 根据当前目录显示清单的路径:
103 |
104 | Cargo定位项目
105 |
106 | ## SEE ALSO
107 |
108 | [cargo(1)](cargo.zh.md), [cargo-metadata(1)](cargo-metadata.html)
109 |
--------------------------------------------------------------------------------
/src/commands/cargo-login.md:
--------------------------------------------------------------------------------
1 | # cargo-login(1)
2 |
3 | ## NAME
4 |
5 | cargo-login - Save an API token from the registry locally
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo login` [_options_] [_token_]
10 |
11 | ## DESCRIPTION
12 |
13 | This command will save the API token to disk so that commands that require
14 | authentication, such as [cargo-publish(1)](cargo-publish.html), will be automatically
15 | authenticated. The token is saved in `$CARGO_HOME/credentials.toml`. `CARGO_HOME`
16 | defaults to `.cargo` in your home directory.
17 |
18 | If the _token_ argument is not specified, it will be read from stdin.
19 |
20 | The API token for crates.io may be retrieved from .
21 |
22 | Take care to keep the token secret, it should not be shared with anyone else.
23 |
24 | ## OPTIONS
25 |
26 | ### Login Options
27 |
28 |
29 |
--registryregistry
30 |
Name of the registry to use. Registry names are defined in Cargo config
31 | files. If not specified, the default registry is used,
32 | which is defined by the registry.default config key which defaults to
33 | crates-io.
34 |
35 |
36 |
37 |
38 | ### Display Options
39 |
40 |
41 |
-v
42 |
--verbose
43 |
Use verbose output. May be specified twice for "very verbose" output which
44 | includes extra output such as dependency warnings and build script output.
45 | May also be specified with the term.verbose
46 | config value.
47 |
48 |
49 |
-q
50 |
--quiet
51 |
Do not print cargo log messages.
52 | May also be specified with the term.quiet
53 | config value.
54 |
55 |
56 |
--colorwhen
57 |
Control when colored output is used. Valid values:
58 |
59 |
auto (default): Automatically detect if color support is available on the
60 | terminal.
61 |
always: Always display colors.
62 |
never: Never display colors.
63 |
64 |
May also be specified with the term.color
65 | config value.
66 |
67 |
68 |
69 |
70 | ### Common Options
71 |
72 |
73 |
74 |
+toolchain
75 |
If Cargo has been installed with rustup, and the first argument to cargo
76 | begins with +, it will be interpreted as a rustup toolchain name (such
77 | as +stable or +nightly).
78 | See the rustup documentation
79 | for more information about how toolchain overrides work.
80 |
81 |
82 |
-h
83 |
--help
84 |
Prints help information.
85 |
86 |
87 |
-Zflag
88 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
Name of the registry to use. Registry names are defined in Cargo config
28 | files. If not specified, the default registry is used,
29 | which is defined by the registry.default config key which defaults to
30 | crates-io.
31 |
32 |
33 |
34 | ### Display Options
35 |
36 |
37 |
-v
38 |
--verbose
39 |
Use verbose output. May be specified twice for "very verbose" output which
40 | includes extra output such as dependency warnings and build script output.
41 | May also be specified with the term.verbose
42 | config value.
43 |
44 |
-q
45 |
--quiet
46 |
Do not print cargo log messages.
47 | May also be specified with the term.quiet
48 | config value.
49 |
50 |
--colorwhen
51 |
Control when colored output is used. Valid values:
52 |
53 |
auto (default): Automatically detect if color support is available on the
54 | terminal.
55 |
always: Always display colors.
56 |
never: Never display colors.
57 |
58 |
May also be specified with the term.color
59 | config value.
60 |
61 |
62 |
63 | ### Common Options
64 |
65 |
66 |
67 |
+toolchain
68 |
If Cargo has been installed with rustup, and the first argument to cargo
69 | begins with +, it will be interpreted as a rustup toolchain name (such
70 | as +stable or +nightly).
71 | See the rustup documentation
72 | for more information about how toolchain overrides work.
73 |
74 |
-h
75 |
--help
76 |
Prints help information.
77 |
78 |
-Zflag
79 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
Show the report with the specified Cargo-generated id
21 |
22 |
-pspec...
23 |
--packagespec...
24 |
Only display a report for the specified package
25 |
26 |
27 |
28 | ## EXAMPLES
29 |
30 | 1. 显示最新的未来不匹配报告:
31 |
32 | Cargo报告未来不匹配
33 |
34 | 2. 显示特定软件包的最新未来不兼容报告:
35 |
36 | Cargo报告未来不匹配——包装我的部门:0.0.1
37 |
38 | ## SEE ALSO
39 |
40 | [Future incompat report](../reference/future-incompat-report.html)
41 |
42 | [cargo(1)](cargo.zh.md)
43 |
--------------------------------------------------------------------------------
/src/commands/cargo-search.md:
--------------------------------------------------------------------------------
1 | # cargo-search(1)
2 |
3 | ## NAME
4 |
5 | cargo-search - Search packages in crates.io
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo search` [_options_] [_query_...]
10 |
11 | ## DESCRIPTION
12 |
13 | This performs a textual search for crates on . The matching
14 | crates will be displayed along with their description in TOML format suitable
15 | for copying into a `Cargo.toml` manifest.
16 |
17 | ## OPTIONS
18 |
19 | ### Search Options
20 |
21 |
22 |
23 |
--limitlimit
24 |
Limit the number of results (default: 10, max: 100).
25 |
26 |
27 |
--indexindex
28 |
The URL of the registry index to use.
29 |
30 |
31 |
32 |
--registryregistry
33 |
Name of the registry to use. Registry names are defined in Cargo config
34 | files. If not specified, the default registry is used,
35 | which is defined by the registry.default config key which defaults to
36 | crates-io.
37 |
38 |
39 |
40 |
41 |
42 | ### Display Options
43 |
44 |
45 |
-v
46 |
--verbose
47 |
Use verbose output. May be specified twice for "very verbose" output which
48 | includes extra output such as dependency warnings and build script output.
49 | May also be specified with the term.verbose
50 | config value.
51 |
52 |
53 |
-q
54 |
--quiet
55 |
Do not print cargo log messages.
56 | May also be specified with the term.quiet
57 | config value.
58 |
59 |
60 |
--colorwhen
61 |
Control when colored output is used. Valid values:
62 |
63 |
auto (default): Automatically detect if color support is available on the
64 | terminal.
65 |
always: Always display colors.
66 |
never: Never display colors.
67 |
68 |
May also be specified with the term.color
69 | config value.
70 |
71 |
72 |
73 |
74 | ### Common Options
75 |
76 |
77 |
78 |
+toolchain
79 |
If Cargo has been installed with rustup, and the first argument to cargo
80 | begins with +, it will be interpreted as a rustup toolchain name (such
81 | as +stable or +nightly).
82 | See the rustup documentation
83 | for more information about how toolchain overrides work.
84 |
85 |
86 |
-h
87 |
--help
88 |
Prints help information.
89 |
90 |
91 |
-Zflag
92 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
Limit the number of results (default: 10, max: 100).
23 |
24 |
--indexindex
25 |
The URL of the registry index to use.
26 |
27 |
--registryregistry
28 |
Name of the registry to use. Registry names are defined in Cargo config
29 | files. If not specified, the default registry is used,
30 | which is defined by the registry.default config key which defaults to
31 | crates-io.
32 |
33 |
34 |
35 | ### Display Options
36 |
37 |
38 |
-v
39 |
--verbose
40 |
Use verbose output. May be specified twice for "very verbose" output which
41 | includes extra output such as dependency warnings and build script output.
42 | May also be specified with the term.verbose
43 | config value.
44 |
45 |
-q
46 |
--quiet
47 |
Do not print cargo log messages.
48 | May also be specified with the term.quiet
49 | config value.
50 |
51 |
--colorwhen
52 |
Control when colored output is used. Valid values:
53 |
54 |
auto (default): Automatically detect if color support is available on the
55 | terminal.
56 |
always: Always display colors.
57 |
never: Never display colors.
58 |
59 |
May also be specified with the term.color
60 | config value.
61 |
62 |
63 |
64 | ### Common Options
65 |
66 |
67 |
68 |
+toolchain
69 |
If Cargo has been installed with rustup, and the first argument to cargo
70 | begins with +, it will be interpreted as a rustup toolchain name (such
71 | as +stable or +nightly).
72 | See the rustup documentation
73 | for more information about how toolchain overrides work.
74 |
75 |
-h
76 |
--help
77 |
Prints help information.
78 |
79 |
-Zflag
80 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
81 |
82 |
83 |
84 | ## ENVIRONMENT
85 |
86 | 查看[the reference](../reference/environment-variables.html)有关Cargo读取的环境变量的详细信息。
87 |
88 | ## EXIT STATUS
89 |
90 | - `0`:Cargo成功。
91 | - `101`:Cargo未能完成。
92 |
93 | ## EXAMPLES
94 |
95 | 1. 从箱子中寻找包。io:
96 |
97 | Cargo搜索服务
98 |
99 | ## SEE ALSO
100 |
101 | [cargo(1)](cargo.zh.md), [cargo-install(1)](cargo-install.html), [cargo-publish(1)](cargo-publish.html)
102 |
--------------------------------------------------------------------------------
/src/commands/cargo-uninstall.md:
--------------------------------------------------------------------------------
1 | # cargo-uninstall(1)
2 |
3 | ## NAME
4 |
5 | cargo-uninstall - Remove a Rust binary
6 |
7 | ## SYNOPSIS
8 |
9 | `cargo uninstall` [_options_] [_spec_...]
10 |
11 | ## DESCRIPTION
12 |
13 | This command removes a package installed with [cargo-install(1)](cargo-install.html). The _spec_
14 | argument is a package ID specification of the package to remove (see
15 | [cargo-pkgid(1)](cargo-pkgid.html)).
16 |
17 | By default all binaries are removed for a crate but the `--bin` and
18 | `--example` flags can be used to only remove particular binaries.
19 |
20 | The installation root is determined, in order of precedence:
21 |
22 | - `--root` option
23 | - `CARGO_INSTALL_ROOT` environment variable
24 | - `install.root` Cargo [config value](../reference/config.html)
25 | - `CARGO_HOME` environment variable
26 | - `$HOME/.cargo`
27 |
28 |
29 | ## OPTIONS
30 |
31 | ### Install Options
32 |
33 |
34 |
35 |
-p
36 |
--packagespec...
37 |
Package to uninstall.
38 |
39 |
40 |
--binname...
41 |
Only uninstall the binary name.
42 |
43 |
44 |
--rootdir
45 |
Directory to uninstall packages from.
46 |
47 |
48 |
49 |
50 | ### Display Options
51 |
52 |
53 |
54 |
-v
55 |
--verbose
56 |
Use verbose output. May be specified twice for "very verbose" output which
57 | includes extra output such as dependency warnings and build script output.
58 | May also be specified with the term.verbose
59 | config value.
60 |
61 |
62 |
-q
63 |
--quiet
64 |
Do not print cargo log messages.
65 | May also be specified with the term.quiet
66 | config value.
67 |
68 |
69 |
--colorwhen
70 |
Control when colored output is used. Valid values:
71 |
72 |
auto (default): Automatically detect if color support is available on the
73 | terminal.
74 |
always: Always display colors.
75 |
never: Never display colors.
76 |
77 |
May also be specified with the term.color
78 | config value.
79 |
80 |
81 |
82 |
83 |
84 | ### Common Options
85 |
86 |
87 |
88 |
+toolchain
89 |
If Cargo has been installed with rustup, and the first argument to cargo
90 | begins with +, it will be interpreted as a rustup toolchain name (such
91 | as +stable or +nightly).
92 | See the rustup documentation
93 | for more information about how toolchain overrides work.
94 |
95 |
96 |
-h
97 |
--help
98 |
Prints help information.
99 |
100 |
101 |
-Zflag
102 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
Use verbose output. May be specified twice for "very verbose" output which
50 | includes extra output such as dependency warnings and build script output.
51 | May also be specified with the term.verbose
52 | config value.
53 |
54 |
-q
55 |
--quiet
56 |
Do not print cargo log messages.
57 | May also be specified with the term.quiet
58 | config value.
59 |
60 |
--colorwhen
61 |
Control when colored output is used. Valid values:
62 |
63 |
auto (default): Automatically detect if color support is available on the
64 | terminal.
65 |
always: Always display colors.
66 |
never: Never display colors.
67 |
68 |
May also be specified with the term.color
69 | config value.
70 |
71 |
72 |
73 | ### Common Options
74 |
75 |
76 |
77 |
+toolchain
78 |
If Cargo has been installed with rustup, and the first argument to cargo
79 | begins with +, it will be interpreted as a rustup toolchain name (such
80 | as +stable or +nightly).
81 | See the rustup documentation
82 | for more information about how toolchain overrides work.
83 |
84 |
-h
85 |
--help
86 |
Prints help information.
87 |
88 |
-Zflag
89 |
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.