8.1 配置 Cargo.toml

01-配置 Cargo.toml — Comprehensive Rust

译文 · 基于 Comprehensive Rust

原文链接: https://google.github.io/comprehensive-rust/chromium/adding-third-party-crates/configuring-cargo-toml.html

8.1 配置 Cargo.toml

Chromium 有一组集中管理的直接 crate 依赖。它们通过单个 Cargo.toml 管理:

1
2
3
4
5
[dependencies]
bitflags = "1"
cfg-if = "1"
cxx = "1"
# 还有很多……

与任何其他 Cargo.toml 一样,你可以指定更多依赖细节——通常,你会想指定希望在 crate 中启用的 features。

向 Chromium 添加 crate 时,你经常需要在另一个文件 gnrt_config.toml 中提供额外信息,我们接下来会见到它。

最后修改 August 11, 2026: 更新 (70a5af133)