Depending on Rust Code from Chromium C++

Simply add the above target to the deps of some Chromium C++ target.

  1. import("//build/rust/rust_static_library.gni")
  2. rust_static_library("my_rust_lib") {
  3. crate_root = "lib.rs"
  4. sources = [ "lib.rs" ]
  5. }
  6. # or source_set, static_library etc.
  7. component("preexisting_cpp") {
  8. deps = [ ":my_rust_lib" ]
  9. }

We’ll see that this relationship only works if the Rust code exposes plain C APIs which can be called from C++, or if we use a C++/Rust interop tool.