doc: update cargo.md #82
This commit is contained in:
parent
f5f05aacf5
commit
e1639d0ce0
@ -127,24 +127,27 @@ $ cargo run
|
|||||||
Hello, world!
|
Hello, world!
|
||||||
```
|
```
|
||||||
|
|
||||||
### 项目目录
|
### 来源配置
|
||||||
|
|
||||||
```bash
|
```toml
|
||||||
.
|
# `source` 表下,就是存储有关要更换的来源名称
|
||||||
├── Cargo.lock
|
[source]
|
||||||
├── Cargo.toml
|
|
||||||
├── benches # 基准目录
|
# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就,定义了一个新源, 叫 `my-awesome-source`,其内容来自本地,`vendor`目录 ,其相对于包含 `.cargo/config` 文件的目录
|
||||||
│ └── large-input.rs
|
[source.my-awesome-source]
|
||||||
├── examples # 示例
|
directory = "vendor"
|
||||||
│ └── simple.rs
|
|
||||||
├── src # 源代码
|
# Git sources 也指定一个 branch/tag/rev
|
||||||
│ ├── bin
|
git = "https://example.com/path/to/repo"
|
||||||
│ │ └── another_executable.rs
|
# branch = "master"
|
||||||
│ ├── lib.rs # 默认库
|
# tag = "v1.0.1"
|
||||||
│ └── main.rs # 入口文件
|
# rev = "313f44e8"
|
||||||
└── tests # 集成测试
|
|
||||||
└── some-integration-tests.rs
|
# crates.io 默认源 在"crates-io"名称下,且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = "my-awesome-source"
|
||||||
```
|
```
|
||||||
|
<!--rehype:className=wrap-text -->
|
||||||
|
|
||||||
### 编译测试
|
### 编译测试
|
||||||
|
|
||||||
@ -163,10 +166,12 @@ $ cargo test # 运行你的所有测试
|
|||||||
# 指定函数过滤器
|
# 指定函数过滤器
|
||||||
$ cargo test test_foo # 开头是 test_foo 的函数都会运行,例如(test_foo_bar)
|
$ cargo test test_foo # 开头是 test_foo 的函数都会运行,例如(test_foo_bar)
|
||||||
# 指定特定模块中的测试函数(通常可以简写 cargo test foo::bar::tests::test_foo)
|
# 指定特定模块中的测试函数(通常可以简写 cargo test foo::bar::tests::test_foo)
|
||||||
cargo test --package rustt --lib -- foo::bar::tests::test_foo --exact --nocapture
|
$ cargo test --package rustt --lib -- foo::bar::tests::test_foo --exact --nocapture
|
||||||
|
|
||||||
# 指定特定测试的模块(通常可以简写 cargo test foo::bar::tests)
|
# 指定特定测试的模块(通常可以简写 cargo test foo::bar::tests)
|
||||||
cargo test --package rustt --lib -- foo::bar::tests --nocapture
|
$ cargo test --package rustt --lib -- foo::bar::tests --nocapture
|
||||||
```
|
```
|
||||||
|
<!--rehype:className=wrap-text-->
|
||||||
|
|
||||||
### 配置目标
|
### 配置目标
|
||||||
<!--rehype:wrap-class=row-span-2-->
|
<!--rehype:wrap-class=row-span-2-->
|
||||||
@ -198,27 +203,24 @@ edition = '2015'
|
|||||||
```
|
```
|
||||||
<!--rehype:className=wrap-text-->
|
<!--rehype:className=wrap-text-->
|
||||||
|
|
||||||
### 来源配置
|
### 项目目录
|
||||||
|
|
||||||
```toml
|
```bash
|
||||||
# `source` 表下,就是存储有关要更换的来源名称
|
.
|
||||||
[source]
|
├── Cargo.lock
|
||||||
|
├── Cargo.toml
|
||||||
# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就,定义了一个新源, 叫 `my-awesome-source`,其内容来自本地,`vendor`目录 ,其相对于包含 `.cargo/config` 文件的目录
|
├── benches # 基准目录
|
||||||
[source.my-awesome-source]
|
│ └── large-input.rs
|
||||||
directory = "vendor"
|
├── examples # 示例
|
||||||
|
│ └── simple.rs
|
||||||
# Git sources 也指定一个 branch/tag/rev
|
├── src # 源代码
|
||||||
git = "https://example.com/path/to/repo"
|
│ ├── bin
|
||||||
# branch = "master"
|
│ │ └── another_executable.rs
|
||||||
# tag = "v1.0.1"
|
│ ├── lib.rs # 默认库
|
||||||
# rev = "313f44e8"
|
│ └── main.rs # 入口文件
|
||||||
|
└── tests # 集成测试
|
||||||
# crates.io 默认源 在"crates-io"名称下,且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
|
└── some-integration-tests.rs
|
||||||
[source.crates-io]
|
|
||||||
replace-with = "my-awesome-source"
|
|
||||||
```
|
```
|
||||||
<!--rehype:className=wrap-text -->
|
|
||||||
|
|
||||||
### 配置
|
### 配置
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user