rust_add()

def rust_add(name, version, rust_toolchain_toml_dir, configure_vscode, configure_zed, deps, visibility) -> dict

Add the Rust toolchain to your sysroot using rustup in the spaces store.

This function creates rules to manage the rust toolchain in the spaces store. It uses rustup_init to install a copy of cargo and the rust toolchain.

It sets up rust-analyzer VS code settings for the workspace. It also sets:

  • RUSTUP_HOME to the rustup directory in the spaces store
  • RUST_TOOLCHAIN to the version of the rust toolchain to use
  • CARGO_HOME to the cargo directory in the spaces store

Example:

load("//@star/packages/star/rust.star", "rust_add")

rust_add("rust", "1.80")

Args

  • name: string: The name of the rule to add the Rust toolchain to
  • version: The version of the Rust toolchain to install
  • rust_toolchain_toml_dir: path to the rust-toolchain.toml file. Runs rustup show in that directory during checkout
  • configure_vscode: bool: Whether to configure VS code settings for the workspace (default is True)
  • configure_zed: bool: Whether to configure Zed settings for the workspace (default is True)
  • deps: list: deps for using chmod
  • visibility: Rule visibility. See visibility.star for more info.

Returns

The rules added by this function (see rules_new())