The Rust Programming Language,2nd Edition
packages that are developed in tandem. A workspace is a set of packages that will all share the same Cargo.lock and output directory. Let’s make a project using a workspace where the code will be trivial so that that we can concentrate on the structure of a workspace. We’ll have a binary that uses two libraries: one that will provide an add_one method and a second that will provide an add_two method. Let’s start modify the binary package’s Cargo.toml to tell Cargo the adder package is a workspace. Add this at the bottom of the file: [workspace] Like many Cargo features, workspaces support convention over con- figuration:0 码力 | 617 页 | 1.54 MB | 1 年前3Comprehensive Rust(Ukrainian) 202412
compass data and log it to the serial port. // TODO } } Cargo.toml (це не потрібно змінювати): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] accessed from any context. unsafe impl Send for Uart {} Cargo.toml (це не потрібно змінювати): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 396 页 | 1.08 MB | 10 月前3Comprehensive Rust(Persian ) 202412
log it to the serial port . / / TODO { { Cargo.toml ) � � � � � � � � � � � � � � � � (: ] workspace [ ] package [ name = "compass " version = "0.1.0 " edition = "2021 " publish = false ] dependencies any context . unsafe impl Send for Uart } { Cargo.toml ) � � � � � � � � � � � � � � � � (: ] workspace [ ] package [ name = "rtc " version = "0.1.0 " edition = "2021 " publish = false ] dependencies0 码力 | 393 页 | 987.97 KB | 10 月前3Rust 程序设计语言 简体中文版 1.85.0
toml 文件,用于配置整个整个工作空间。它不会包含 [package] 部分。相反,它以 [workspace] 部分作为开始,允许我们向工作区添加成员。我们 还通过将 resolver 设置为 "3",在工作区中使用 Cargo 最新且最强大的解析算法。 文件名:Cargo.toml [workspace] resolver = "3" 接下来,在 add 目录运行 cargo new 新建 package Adding `adder` as member of workspace at `file:///projects/add` 在工作空间中运行 cargo new 也会自动将新建包加入到工作空间 Cargo.toml 的 [workspace] 定义的 members 键中,像这样: [workspace] resolver = "3" members = ["adder"] package Adding `add_one` as member of workspace at `file:///projects/add` 现在顶层的 Cargo.toml 的 members 列表将会包含 add_one* 路径: 文件名:Cargo.toml [workspace] resolver = "3" members = ["adder", "add_one"]0 码力 | 562 页 | 3.23 MB | 9 天前3Comprehensive Rust(English) 202412
and log it to the serial port. // TODO } } Cargo.toml (you shouldn't need to change this): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] from any context. unsafe impl Send for Uart {} Cargo.toml (you shouldn't need to change this): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 382 页 | 1.00 MB | 10 月前3Comprehensive Rust ?
and log it to the serial port. // TODO } } Cargo.toml (you shouldn't need to change this): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] from any context. unsafe impl Send for Uart {} Cargo.toml (you shouldn't need to change this): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 378 页 | 1009.46 KB | 1 年前3Comprehensive Rust(简体中文) 202412
loop { // Read compass data and log it to the serial port. // TODO } } Cargo.toml(无需对此进行更改): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] which can be // accessed from any context. unsafe impl Send for Uart {} Cargo.toml(无需对此进行更改): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 359 页 | 1.33 MB | 10 月前3Comprehensive Rust(Español) 202412
and log it to the serial port. // TODO } } Cargo.toml (you shouldn't need to change this): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] from any context. unsafe impl Send for Uart {} Cargo.toml (you shouldn't need to change this): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 389 页 | 1.04 MB | 10 月前3Comprehensive Rust(繁体中文)
// Read compass data and log it to the serial port. // TODO } } Cargo.toml (您應該不需要變更此項目): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] be 288 // accessed from any context. unsafe impl Send for Uart {} Cargo.toml (您應該不需要變更此項目): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 358 页 | 1.41 MB | 10 月前3Comprehensive Rust(Português do Brasil) 202412
and log it to the serial port. // TODO } } Cargo.toml (você não deve precisar alterar isso): [workspace] [package] name = "compass" version = "0.1.0" edition = "2021" publish = false [dependencies] any context. unsafe impl Send for Uart {} Cargo.toml (você não deve precisar alterar isso): [workspace] [package] name = "rtc" version = "0.1.0" edition = "2021" publish = false [dependencies] arm-gic0 码力 | 389 页 | 1.05 MB | 10 月前3
共 15 条
- 1
- 2