blob: ec7f4d5185d8635e0eb1af17a1fc1e5d71c8bac6 [file] [log] [blame] [edit]
<!DOCTYPE HTML>
<html lang="en" class="light sidebar-visible" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>cargo - rules_rust</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Start loading toc.js asap -->
<script src="toc.js"></script>
</head>
<body>
<div id="body-container">
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
const html = document.documentElement;
html.classList.remove('light')
html.classList.add(theme);
html.classList.add("js");
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<!-- populated by js -->
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
<noscript>
<iframe class="sidebar-iframe-outer" src="toc.html"></iframe>
</noscript>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">rules_rust</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/bazelbuild/rules_rust" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
<h1 id="cargo"><a class="header" href="#cargo">Cargo</a></h1>
<ul>
<li><a href="#cargo_bootstrap_repository">cargo_bootstrap_repository</a></li>
<li><a href="#cargo_build_script">cargo_build_script</a></li>
<li><a href="#cargo_dep_env">cargo_dep_env</a></li>
<li><a href="#cargo_env">cargo_env</a></li>
</ul>
<p><a id="cargo_dep_env"></a></p>
<h2 id="cargo_dep_env"><a class="header" href="#cargo_dep_env">cargo_dep_env</a></h2>
<pre>
cargo_dep_env(<a href="#cargo_dep_env-name">name</a>, <a href="#cargo_dep_env-src">src</a>, <a href="#cargo_dep_env-out_dir">out_dir</a>)
</pre>
<p>A rule for generating variables for dependent <code>cargo_build_script</code>s without a build script. This is useful for using Bazel rules instead of a build script, while also generating configuration information for build scripts which depend on this crate.</p>
<p><strong>ATTRIBUTES</strong></p>
<div class="table-wrapper"><table><thead><tr><th style="text-align: left">Name</th><th style="text-align: left">Description</th><th style="text-align: left">Type</th><th style="text-align: left">Mandatory</th><th style="text-align: left">Default</th></tr></thead><tbody>
<tr><td style="text-align: left"><a id="cargo_dep_env-name"></a>name</td><td style="text-align: left">A unique name for this target.</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels#target-names">Name</a></td><td style="text-align: left">required</td><td style="text-align: left"></td></tr>
<tr><td style="text-align: left"><a id="cargo_dep_env-src"></a>src</td><td style="text-align: left">File containing additional environment variables to set for build scripts of direct dependencies.<br><br>This has the same effect as a <code>cargo_build_script</code> which prints <code>cargo:VAR=VALUE</code> lines, but without requiring a build script.<br><br>This files should contain a single variable per line, of format <code>NAME=value</code>, and newlines may be included in a value by ending a line with a trailing back-slash (<code>\\</code>).</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels">Label</a></td><td style="text-align: left">required</td><td style="text-align: left"></td></tr>
<tr><td style="text-align: left"><a id="cargo_dep_env-out_dir"></a>out_dir</td><td style="text-align: left">Folder containing additional inputs when building all direct dependencies.<br><br>This has the same effect as a <code>cargo_build_script</code> which prints puts files into <code>$OUT_DIR</code>, but without requiring a build script.</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels">Label</a></td><td style="text-align: left">optional</td><td style="text-align: left"><code>None</code></td></tr>
</tbody></table>
</div>
<p><a id="cargo_build_script"></a></p>
<h2 id="cargo_build_script"><a class="header" href="#cargo_build_script">cargo_build_script</a></h2>
<pre>
cargo_build_script(<a href="#cargo_build_script-name">name</a>, <a href="#cargo_build_script-edition">edition</a>, <a href="#cargo_build_script-crate_name">crate_name</a>, <a href="#cargo_build_script-crate_root">crate_root</a>, <a href="#cargo_build_script-srcs">srcs</a>, <a href="#cargo_build_script-crate_features">crate_features</a>, <a href="#cargo_build_script-version">version</a>, <a href="#cargo_build_script-deps">deps</a>,
<a href="#cargo_build_script-link_deps">link_deps</a>, <a href="#cargo_build_script-proc_macro_deps">proc_macro_deps</a>, <a href="#cargo_build_script-build_script_env">build_script_env</a>, <a href="#cargo_build_script-data">data</a>, <a href="#cargo_build_script-compile_data">compile_data</a>, <a href="#cargo_build_script-tools">tools</a>, <a href="#cargo_build_script-links">links</a>,
<a href="#cargo_build_script-rundir">rundir</a>, <a href="#cargo_build_script-rustc_env">rustc_env</a>, <a href="#cargo_build_script-rustc_env_files">rustc_env_files</a>, <a href="#cargo_build_script-rustc_flags">rustc_flags</a>, <a href="#cargo_build_script-visibility">visibility</a>, <a href="#cargo_build_script-tags">tags</a>, <a href="#cargo_build_script-aliases">aliases</a>,
<a href="#cargo_build_script-pkg_name">pkg_name</a>, <a href="#cargo_build_script-kwargs">kwargs</a>)
</pre>
<p>Compile and execute a rust build script to generate build attributes</p>
<p>This rules take the same arguments as rust_binary.</p>
<p>Example:</p>
<p>Suppose you have a crate with a cargo build script <code>build.rs</code>:</p>
<pre><code class="language-output">[workspace]/
hello_lib/
BUILD
build.rs
src/
lib.rs
</code></pre>
<p>Then you want to use the build script in the following:</p>
<p><code>hello_lib/BUILD</code>:</p>
<pre><code class="language-python">package(default_visibility = ["//visibility:public"])
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
# This will run the build script from the root of the workspace, and
# collect the outputs.
cargo_build_script(
name = "build_script",
srcs = ["build.rs"],
# Optional environment variables passed during build.rs compilation
rustc_env = {
"CARGO_PKG_VERSION": "0.1.2",
},
# Optional environment variables passed during build.rs execution.
# Note that as the build script's working directory is not execroot,
# execpath/location will return an absolute path, instead of a relative
# one.
build_script_env = {
"SOME_TOOL_OR_FILE": "$(execpath @tool//:binary)"
},
# Optional data/tool dependencies
data = ["@tool//:binary"],
)
rust_library(
name = "hello_lib",
srcs = [
"src/lib.rs",
],
deps = [":build_script"],
)
</code></pre>
<p>The <code>hello_lib</code> target will be build with the flags and the environment variables declared by the build script in addition to the file generated by it.</p>
<p><strong>PARAMETERS</strong></p>
<div class="table-wrapper"><table><thead><tr><th style="text-align: left">Name</th><th style="text-align: left">Description</th><th style="text-align: left">Default Value</th></tr></thead><tbody>
<tr><td style="text-align: left"><a id="cargo_build_script-name"></a>name</td><td style="text-align: left">The name for the underlying rule. This should be the name of the package being compiled, optionally with a suffix of <code>_bs</code>. Otherwise, you can set the package name via <code>pkg_name</code>.</td><td style="text-align: left">none</td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-edition"></a>edition</td><td style="text-align: left">The rust edition to use for the internal binary crate.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-crate_name"></a>crate_name</td><td style="text-align: left">Crate name to use for build script.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-crate_root"></a>crate_root</td><td style="text-align: left">The file that will be passed to rustc to be used for building this crate.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-srcs"></a>srcs</td><td style="text-align: left">Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-crate_features"></a>crate_features</td><td style="text-align: left">A list of features to enable for the build script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-version"></a>version</td><td style="text-align: left">The semantic version (semver) of the crate.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-deps"></a>deps</td><td style="text-align: left">The build-dependencies of the crate.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-link_deps"></a>link_deps</td><td style="text-align: left">The subset of the (normal) dependencies of the crate that have the links attribute and therefore provide environment variables to this build script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-proc_macro_deps"></a>proc_macro_deps</td><td style="text-align: left">List of rust_proc_macro targets used to build the script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-build_script_env"></a>build_script_env</td><td style="text-align: left">Environment variables for build scripts.</td><td style="text-align: left"><code>{}</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-data"></a>data</td><td style="text-align: left">Files needed by the build script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-compile_data"></a>compile_data</td><td style="text-align: left">Files needed for the compilation of the build script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-tools"></a>tools</td><td style="text-align: left">Tools (executables) needed by the build script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-links"></a>links</td><td style="text-align: left">Name of the native library this crate links against.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-rundir"></a>rundir</td><td style="text-align: left">A directory to <code>cd</code> to before the cargo_build_script is run. This should be a path relative to the exec root.<br><br>The default behaviour (and the behaviour if rundir is set to the empty string) is to change to the relative path corresponding to the cargo manifest directory, which replicates the normal behaviour of cargo so it is easy to write compatible build scripts.<br><br>If set to <code>.</code>, the cargo build script will run in the exec root.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-rustc_env"></a>rustc_env</td><td style="text-align: left">Environment variables to set in rustc when compiling the build script.</td><td style="text-align: left"><code>{}</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-rustc_env_files"></a>rustc_env_files</td><td style="text-align: left">Files containing additional environment variables to set for rustc when building the build script.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-rustc_flags"></a>rustc_flags</td><td style="text-align: left">List of compiler flags passed to <code>rustc</code>.</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-visibility"></a>visibility</td><td style="text-align: left">Visibility to apply to the generated build script output.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-tags"></a>tags</td><td style="text-align: left">(list of str, optional): Tags to apply to the generated build script output.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-aliases"></a>aliases</td><td style="text-align: left">Remap crates to a new name or moniker for linkage to this target. These are other <code>rust_library</code> targets and will be presented as the new name given.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-pkg_name"></a>pkg_name</td><td style="text-align: left">Override the package name used for the build script. This is useful if the build target name gets too long otherwise.</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_build_script-kwargs"></a>kwargs</td><td style="text-align: left">Forwards to the underlying <code>rust_binary</code> rule. An exception is the <code>compatible_with</code> attribute, which shouldn't be forwarded to the <code>rust_binary</code>, as the <code>rust_binary</code> is only built and used in <code>exec</code> mode. We propagate the <code>compatible_with</code> attribute to the <code>_build_scirpt_run</code> target.</td><td style="text-align: left">none</td></tr>
</tbody></table>
</div>
<p><a id="cargo_env"></a></p>
<h2 id="cargo_env"><a class="header" href="#cargo_env">cargo_env</a></h2>
<pre>
cargo_env(<a href="#cargo_env-env">env</a>)
</pre>
<p>A helper for generating platform specific environment variables</p>
<pre><code class="language-python">load("@rules_rust//rust:defs.bzl", "rust_common")
load("@rules_rust//cargo:defs.bzl", "cargo_bootstrap_repository", "cargo_env")
cargo_bootstrap_repository(
name = "bootstrapped_bin",
cargo_lockfile = "//:Cargo.lock",
cargo_toml = "//:Cargo.toml",
srcs = ["//:resolver_srcs"],
version = rust_common.default_version,
binary = "my-crate-binary",
env = {
"x86_64-unknown-linux-gnu": cargo_env({
"FOO": "BAR",
}),
},
env_label = {
"aarch64-unknown-linux-musl": cargo_env({
"DOC": "//:README.md",
}),
}
)
</code></pre>
<p><strong>PARAMETERS</strong></p>
<div class="table-wrapper"><table><thead><tr><th style="text-align: left">Name</th><th style="text-align: left">Description</th><th style="text-align: left">Default Value</th></tr></thead><tbody>
<tr><td style="text-align: left"><a id="cargo_env-env"></a>env</td><td style="text-align: left">A map of environment variables</td><td style="text-align: left">none</td></tr>
</tbody></table>
</div>
<p><strong>RETURNS</strong></p>
<p>str: A json encoded string of the environment variables</p>
<p><a id="cargo_bootstrap_repository"></a></p>
<h2 id="cargo_bootstrap_repository"><a class="header" href="#cargo_bootstrap_repository">cargo_bootstrap_repository</a></h2>
<pre>
cargo_bootstrap_repository(<a href="#cargo_bootstrap_repository-name">name</a>, <a href="#cargo_bootstrap_repository-srcs">srcs</a>, <a href="#cargo_bootstrap_repository-binary">binary</a>, <a href="#cargo_bootstrap_repository-build_mode">build_mode</a>, <a href="#cargo_bootstrap_repository-cargo_config">cargo_config</a>, <a href="#cargo_bootstrap_repository-cargo_lockfile">cargo_lockfile</a>, <a href="#cargo_bootstrap_repository-cargo_toml">cargo_toml</a>,
<a href="#cargo_bootstrap_repository-env">env</a>, <a href="#cargo_bootstrap_repository-env_label">env_label</a>, <a href="#cargo_bootstrap_repository-repo_mapping">repo_mapping</a>, <a href="#cargo_bootstrap_repository-rust_toolchain_cargo_template">rust_toolchain_cargo_template</a>,
<a href="#cargo_bootstrap_repository-rust_toolchain_rustc_template">rust_toolchain_rustc_template</a>, <a href="#cargo_bootstrap_repository-timeout">timeout</a>, <a href="#cargo_bootstrap_repository-version">version</a>)
</pre>
<p>A rule for bootstrapping a Rust binary using <a href="https://doc.rust-lang.org/cargo/">Cargo</a></p>
<p><strong>ATTRIBUTES</strong></p>
<div class="table-wrapper"><table><thead><tr><th style="text-align: left">Name</th><th style="text-align: left">Description</th><th style="text-align: left">Type</th><th style="text-align: left">Mandatory</th><th style="text-align: left">Default</th></tr></thead><tbody>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-name"></a>name</td><td style="text-align: left">A unique name for this repository.</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels#target-names">Name</a></td><td style="text-align: left">required</td><td style="text-align: left"></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-srcs"></a>srcs</td><td style="text-align: left">Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels">List of labels</a></td><td style="text-align: left">optional</td><td style="text-align: left"><code>[]</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-binary"></a>binary</td><td style="text-align: left">The binary to build (the <code>--bin</code> parameter for Cargo). If left empty, the repository name will be used.</td><td style="text-align: left">String</td><td style="text-align: left">optional</td><td style="text-align: left"><code>""</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-build_mode"></a>build_mode</td><td style="text-align: left">The build mode the binary should be built with</td><td style="text-align: left">String</td><td style="text-align: left">optional</td><td style="text-align: left"><code>"release"</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-cargo_config"></a>cargo_config</td><td style="text-align: left">The path of the Cargo configuration (<code>Config.toml</code>) file.</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels">Label</a></td><td style="text-align: left">optional</td><td style="text-align: left"><code>None</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-cargo_lockfile"></a>cargo_lockfile</td><td style="text-align: left">The lockfile of the crate_universe resolver</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels">Label</a></td><td style="text-align: left">required</td><td style="text-align: left"></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-cargo_toml"></a>cargo_toml</td><td style="text-align: left">The path of the <code>Cargo.toml</code> file.</td><td style="text-align: left"><a href="https://bazel.build/concepts/labels">Label</a></td><td style="text-align: left">required</td><td style="text-align: left"></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-env"></a>env</td><td style="text-align: left">A mapping of platform triple to a set of environment variables. See <a href="#cargo_env">cargo_env</a> for usage details. Additionally, the platform triple <code>*</code> applies to all platforms.</td><td style="text-align: left"><a href="https://bazel.build/rules/lib/dict">Dictionary: String -&gt; String</a></td><td style="text-align: left">optional</td><td style="text-align: left"><code>{}</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-env_label"></a>env_label</td><td style="text-align: left">A mapping of platform triple to a set of environment variables. This attribute differs from <code>env</code> in that all variables passed here must be fully qualified labels of files. See <a href="#cargo_env">cargo_env</a> for usage details. Additionally, the platform triple <code>*</code> applies to all platforms.</td><td style="text-align: left"><a href="https://bazel.build/rules/lib/dict">Dictionary: String -&gt; String</a></td><td style="text-align: left">optional</td><td style="text-align: left"><code>{}</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-repo_mapping"></a>repo_mapping</td><td style="text-align: left">In <code>WORKSPACE</code> context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>).<br><br>This attribute is <em>not</em> supported in <code>MODULE.bazel</code> context (when invoking a repository rule inside a module extension's implementation function).</td><td style="text-align: left"><a href="https://bazel.build/rules/lib/dict">Dictionary: String -&gt; String</a></td><td style="text-align: left">optional</td><td style="text-align: left"></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-rust_toolchain_cargo_template"></a>rust_toolchain_cargo_template</td><td style="text-align: left">The template to use for finding the host <code>cargo</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present.</td><td style="text-align: left">String</td><td style="text-align: left">optional</td><td style="text-align: left"><code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template</td><td style="text-align: left">The template to use for finding the host <code>rustc</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present.</td><td style="text-align: left">String</td><td style="text-align: left">optional</td><td style="text-align: left"><code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-timeout"></a>timeout</td><td style="text-align: left">Maximum duration of the Cargo build command in seconds</td><td style="text-align: left">Integer</td><td style="text-align: left">optional</td><td style="text-align: left"><code>600</code></td></tr>
<tr><td style="text-align: left"><a id="cargo_bootstrap_repository-version"></a>version</td><td style="text-align: left">The version of Rust the currently registered toolchain is using. Eg. <code>1.56.0</code>, or <code>nightly/2021-09-08</code></td><td style="text-align: left">String</td><td style="text-align: left">optional</td><td style="text-align: left"><code>"1.82.0"</code></td></tr>
</tbody></table>
</div>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="rust_wasm_bindgen.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="rust_analyzer.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="rust_wasm_bindgen.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="rust_analyzer.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>