Cargo
Rules for interoperating with tooling from the Cargo ecosystem — most
importantly, Cargo build.rs scripts. These rules let a Bazel
build consume the same crate-side conventions that Cargo uses (build scripts,
generated env vars, [lints] tables) without switching build systems.
Rules
- cargo_build_script — Compile and run a crate's
build.rsat build time, then feed the emittedcargo:*directives (env vars, link args, rerun-if-changed inputs) into consumers of the crate. - cargo_env — Helper that returns Cargo's standard
CARGO_*env-var dict, used by rules that need to reproduce Cargo's compilation environment. - extract_cargo_lints — Read the
[lints]table from aCargo.tomland produce arust_lint_configtarget from it, so Cargo-defined lints apply to Bazel-built crates.