Depending on a Crate

Once you’ve added a third-party crate and generated build rules, depending on a crate is simple. Find your rust_static_library target, and add a dep on the :lib target within your crate.

Specifically,

45.6. Depending on a Crate - 图1

For instance,

  1. rust_static_library("my_rust_lib") {
  2. crate_root = "lib.rs"
  3. sources = [ "lib.rs" ]
  4. deps = [ "//third_party/rust/example_rust_crate/v1:lib" ]
  5. }