Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

使用 Crate

新增第三方 Crate 並產生建構規則後,依附 Crate 就很簡單。請找出 rust_static_library 目標,然後在 Crate 的 :lib 目標中新增 dep

Specifically,

cratenamemajorsemverversion//third_party/rust/v:lib

舉例來說:

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