diff --git a/flatten.html b/flatten.html index 3d95c5a3de..51a6aa04d3 100644 --- a/flatten.html +++ b/flatten.html @@ -325,10 +325,10 @@

rust_binary

-rust_binary(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name,
-            crate_root, crate_type, edition, env, experimental_use_cc_common_link, linker_script,
-            malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags,
-            stamp, version)
+rust_binary(name, deps, srcs, data, aliases, alwayslink, binary_name, compile_data, crate_features,
+            crate_name, crate_root, crate_type, edition, env, experimental_use_cc_common_link,
+            linker_script, malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files,
+            rustc_flags, stamp, version)
 

Builds a Rust binary crate.

Example:

@@ -410,6 +410,7 @@

rust_binary

dataList of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles.List of labelsoptional[] aliasesRemap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given.Dictionary: Label -> Stringoptional{} alwayslinkIf 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.

This attribute is used by the C++ Starlark API when passing CcInfo providers.BooleanoptionalFalse +binary_nameOverride the resulting binary file name. By default, the binary file will be named using the name attribute on this rule, however sometimes that is not deseriable.Stringoptional"" compile_dataList of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro.List of labelsoptional[] crate_featuresList of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags.List of stringsoptional[] crate_nameCrate name to use for this target.

This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores.Stringoptional"" diff --git a/print.html b/print.html index 0b6f342ed0..68c6785d2f 100644 --- a/print.html +++ b/print.html @@ -322,10 +322,10 @@

extra_rus

rust_binary

-rust_binary(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name,
-            crate_root, crate_type, edition, env, experimental_use_cc_common_link, linker_script,
-            malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags,
-            stamp, version)
+rust_binary(name, deps, srcs, data, aliases, alwayslink, binary_name, compile_data, crate_features,
+            crate_name, crate_root, crate_type, edition, env, experimental_use_cc_common_link,
+            linker_script, malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files,
+            rustc_flags, stamp, version)
 

Builds a Rust binary crate.

Example:

@@ -407,6 +407,7 @@

rust_binary

dataList of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles.List of labelsoptional[] aliasesRemap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given.Dictionary: Label -> Stringoptional{} alwayslinkIf 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.

This attribute is used by the C++ Starlark API when passing CcInfo providers.BooleanoptionalFalse +binary_nameOverride the resulting binary file name. By default, the binary file will be named using the name attribute on this rule, however sometimes that is not deseriable.Stringoptional"" compile_dataList of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro.List of labelsoptional[] crate_featuresList of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags.List of stringsoptional[] crate_nameCrate name to use for this target.

This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores.Stringoptional"" @@ -2098,10 +2099,10 @@

rust_binary

-rust_binary(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name,
-            crate_root, crate_type, edition, env, experimental_use_cc_common_link, linker_script,
-            malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags,
-            stamp, version)
+rust_binary(name, deps, srcs, data, aliases, alwayslink, binary_name, compile_data, crate_features,
+            crate_name, crate_root, crate_type, edition, env, experimental_use_cc_common_link,
+            linker_script, malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files,
+            rustc_flags, stamp, version)
 

Builds a Rust binary crate.

Example:

@@ -2183,6 +2184,7 @@

rust_binarydataList of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles.List of labelsoptional[] aliasesRemap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given.Dictionary: Label -> Stringoptional{} alwayslinkIf 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.

This attribute is used by the C++ Starlark API when passing CcInfo providers.BooleanoptionalFalse +binary_nameOverride the resulting binary file name. By default, the binary file will be named using the name attribute on this rule, however sometimes that is not deseriable.Stringoptional"" compile_dataList of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro.List of labelsoptional[] crate_featuresList of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags.List of stringsoptional[] crate_nameCrate name to use for this target.

This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores.Stringoptional"" diff --git a/rust.html b/rust.html index 146d748093..5969b893b3 100644 --- a/rust.html +++ b/rust.html @@ -239,10 +239,10 @@

extra_rus

rust_binary

-rust_binary(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name,
-            crate_root, crate_type, edition, env, experimental_use_cc_common_link, linker_script,
-            malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags,
-            stamp, version)
+rust_binary(name, deps, srcs, data, aliases, alwayslink, binary_name, compile_data, crate_features,
+            crate_name, crate_root, crate_type, edition, env, experimental_use_cc_common_link,
+            linker_script, malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files,
+            rustc_flags, stamp, version)
 

Builds a Rust binary crate.

Example:

@@ -324,6 +324,7 @@

rust_binary

dataList of files used by this rule at compile time and runtime.

If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles.List of labelsoptional[] aliasesRemap crates to a new name or moniker for linkage to this target

These are other rust_library targets and will be presented as the new name given.Dictionary: Label -> Stringoptional{} alwayslinkIf 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.

This attribute is used by the C++ Starlark API when passing CcInfo providers.BooleanoptionalFalse +binary_nameOverride the resulting binary file name. By default, the binary file will be named using the name attribute on this rule, however sometimes that is not deseriable.Stringoptional"" compile_dataList of files used by this rule at compile time.

This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro.List of labelsoptional[] crate_featuresList of features to enable for this crate.

Features are defined in the code using the #[cfg(feature = "foo")] configuration option. The features listed here will be passed to rustc with --cfg feature="${feature_name}" flags.List of stringsoptional[] crate_nameCrate name to use for this target.

This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores.Stringoptional"" diff --git a/searchindex.js b/searchindex.js index 1ac4641a90..f92ba9eccd 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Object.assign(window.search, {"doc_urls":["index.html#rules-rust","index.html#setup","index.html#bzlmod","index.html#workspace","index.html#specifying-rust-version","index.html#supported-bazel-versions","index.html#supported-platforms","rules.html#rules","rules.html#experimental-rules","rules.html#3rd-party-rules","rules.html#full-api","rust.html#rust","rust.html#capture_clippy_output","rust.html#error_format","rust.html#extra_rustc_flag","rust.html#extra_rustc_flags","rust.html#rust_binary","rust.html#rust_library","rust.html#rust_library_group","rust.html#rust_proc_macro","rust.html#rust_shared_library","rust.html#rust_static_library","rust.html#rust_test","rust.html#example-test-directory","rust.html#rust_test_suite","rust_doc.html#rust-doc","rust_doc.html#rust_doc","rust_doc.html#rust_doc_test","rust_clippy.html#rust-clippy","rust_clippy.html#overview","rust_clippy.html#setup","rust_clippy.html#rust_clippy","rust_clippy.html#rust_clippy_aspect","rust_fmt.html#rust-fmt","rust_fmt.html#overview","rust_fmt.html#setup","rust_fmt.html#tips","rust_fmt.html#rustfmt_test","rust_fmt.html#rustfmt_toolchain","rust_fmt.html#rustfmt_aspect","rust_proto.html#rust-proto","rust_proto.html#overview","rust_proto.html#prost-setup","rust_proto.html#rust-protobuf-setup","rust_proto.html#rust_grpc_library","rust_proto.html#rust_prost_toolchain","rust_proto.html#rust_proto_library","rust_proto.html#rust_prost_dependencies","rust_proto.html#rust_prost_library","rust_proto.html#rust_prost_transitive_repositories","rust_proto.html#rust_proto_protobuf_dependencies","rust_proto.html#rust_proto_protobuf_register_toolchains","rust_proto.html#rust_proto_protobuf_transitive_repositories","rust_bindgen.html#rust-bindgen","rust_bindgen.html#overview","rust_bindgen.html#setup","rust_bindgen.html#rust_bindgen","rust_bindgen.html#rust_bindgen_toolchain","rust_bindgen.html#rust_bindgen_dependencies","rust_bindgen.html#rust_bindgen_library","rust_bindgen.html#rust_bindgen_register_toolchains","rust_wasm_bindgen.html#rust-wasm-bindgen","rust_wasm_bindgen.html#overview","rust_wasm_bindgen.html#setup","rust_wasm_bindgen.html#interfacing-with-javascript-rules","rust_wasm_bindgen.html#rust_wasm_bindgen","rust_wasm_bindgen.html#rust_wasm_bindgen_toolchain","rust_wasm_bindgen.html#rustwasmbindgeninfo","rust_wasm_bindgen.html#rust_wasm_bindgen_dependencies","rust_wasm_bindgen.html#rust_wasm_bindgen_register_toolchains","cargo.html#cargo","cargo.html#cargo_dep_env","cargo.html#cargo_build_script","cargo.html#cargo_env","cargo.html#cargo_bootstrap_repository","rust_analyzer.html#rust-analyzer","rust_analyzer.html#overview","rust_analyzer.html#setup","rust_analyzer.html#rust_analyzer_toolchain","rust_analyzer.html#rust_analyzer_aspect","flatten.html#rust-rules","flatten.html#capture_clippy_output","flatten.html#cargo_dep_env","flatten.html#error_format","flatten.html#extra_rustc_flag","flatten.html#extra_rustc_flags","flatten.html#incompatible_flag","flatten.html#rust_analyzer_toolchain","flatten.html#rust_binary","flatten.html#rust_bindgen","flatten.html#rust_bindgen_toolchain","flatten.html#rust_clippy","flatten.html#rust_doc","flatten.html#rust_doc_test","flatten.html#rust_grpc_library","flatten.html#rust_library","flatten.html#rust_library_group","flatten.html#rust_proc_macro","flatten.html#rust_prost_toolchain","flatten.html#rust_proto_library","flatten.html#rust_shared_library","flatten.html#rust_static_library","flatten.html#rust_stdlib_filegroup","flatten.html#rust_test","flatten.html#example-test-directory","flatten.html#rust_toolchain","flatten.html#rust_wasm_bindgen","flatten.html#rust_wasm_bindgen_toolchain","flatten.html#rustfmt_test","flatten.html#rustfmt_toolchain","flatten.html#crateinfo","flatten.html#depinfo","flatten.html#rustwasmbindgeninfo","flatten.html#stdlibinfo","flatten.html#cargo_build_script","flatten.html#cargo_env","flatten.html#rules_rust_dependencies","flatten.html#rust_analyzer_toolchain_repository","flatten.html#rust_bindgen_dependencies","flatten.html#rust_bindgen_library","flatten.html#rust_bindgen_register_toolchains","flatten.html#rust_prost_dependencies","flatten.html#rust_prost_library","flatten.html#rust_prost_transitive_repositories","flatten.html#rust_proto_protobuf_dependencies","flatten.html#rust_proto_protobuf_register_toolchains","flatten.html#rust_proto_protobuf_transitive_repositories","flatten.html#rust_register_toolchains","flatten.html#rust_repositories","flatten.html#rust_repository_set","flatten.html#rust_test_suite","flatten.html#rust_toolchain_repository","flatten.html#rust_wasm_bindgen_dependencies","flatten.html#rust_wasm_bindgen_register_toolchains","flatten.html#rust_analyzer_aspect","flatten.html#rust_clippy_aspect","flatten.html#rustfmt_aspect","flatten.html#cargo_bootstrap_repository","flatten.html#rust_toolchain_repository_proxy","flatten.html#rust_toolchain_tools_repository","external_crates.html#external-dependencies","crate_universe_bzlmod.html#crate-universe","crate_universe_bzlmod.html#table-of-contents","crate_universe_bzlmod.html#setup","crate_universe_bzlmod.html#dependencies","crate_universe_bzlmod.html#cargo-workspaces","crate_universe_bzlmod.html#direct-dependencies","crate_universe_bzlmod.html#vendored-dependencies","crate_universe_bzlmod.html#crate","crate_universe_bzlmod.html#from_cargo","crate_universe_bzlmod.html#annotation","crate_universe_bzlmod.html#from_specs","crate_universe_bzlmod.html#spec","crate_universe.html#crate-universe","crate_universe.html#setup","crate_universe.html#rules","crate_universe.html#utility-macros","crate_universe.html#workflows","crate_universe.html#cargo-workspaces","crate_universe.html#direct-packages","crate_universe.html#binary-dependencies","crate_universe.html#dependencies-api","crate_universe.html#building-crates-with-complicated-dependencies","crate_universe.html#some-things-work-without-intervention","crate_universe.html#supplying-extra-tools-to-build","crate_universe.html#building-with-bazel-and-supplying-via-an-override","crate_universe.html#crates_vendor","crate_universe.html#repinning--updating-dependencies","crate_universe.html#aliases","crate_universe.html#all_crate_deps","crate_universe.html#crateannotation","crate_universe.html#crateselect","crate_universe.html#cratespec","crate_universe.html#crateworkspace_member","crate_universe.html#crate_deps","crate_universe.html#crate_repositories","crate_universe.html#crate_universe_dependencies","crate_universe.html#render_config","crate_universe.html#splicing_config","crate_universe.html#crates_repository","crate_universe.html#repinning--updating-dependencies-1","upstream_tooling.html#upstream-tooling"],"index":{"documentStore":{"docInfo":{"0":{"body":7,"breadcrumbs":3,"title":2},"1":{"body":12,"breadcrumbs":2,"title":1},"10":{"body":5,"breadcrumbs":3,"title":2},"100":{"body":586,"breadcrumbs":3,"title":1},"101":{"body":521,"breadcrumbs":3,"title":1},"102":{"body":31,"breadcrumbs":3,"title":1},"103":{"body":126,"breadcrumbs":3,"title":1},"104":{"body":674,"breadcrumbs":5,"title":3},"105":{"body":541,"breadcrumbs":3,"title":1},"106":{"body":75,"breadcrumbs":3,"title":1},"107":{"body":70,"breadcrumbs":3,"title":1},"108":{"body":30,"breadcrumbs":3,"title":1},"109":{"body":52,"breadcrumbs":3,"title":1},"11":{"body":12,"breadcrumbs":3,"title":1},"110":{"body":187,"breadcrumbs":3,"title":1},"111":{"body":90,"breadcrumbs":3,"title":1},"112":{"body":31,"breadcrumbs":3,"title":1},"113":{"body":106,"breadcrumbs":3,"title":1},"114":{"body":396,"breadcrumbs":3,"title":1},"115":{"body":59,"breadcrumbs":3,"title":1},"116":{"body":5,"breadcrumbs":3,"title":1},"117":{"body":124,"breadcrumbs":3,"title":1},"118":{"body":12,"breadcrumbs":3,"title":1},"119":{"body":105,"breadcrumbs":3,"title":1},"12":{"body":23,"breadcrumbs":3,"title":1},"120":{"body":17,"breadcrumbs":3,"title":1},"121":{"body":22,"breadcrumbs":3,"title":1},"122":{"body":25,"breadcrumbs":3,"title":1},"123":{"body":11,"breadcrumbs":3,"title":1},"124":{"body":33,"breadcrumbs":3,"title":1},"125":{"body":12,"breadcrumbs":3,"title":1},"126":{"body":11,"breadcrumbs":3,"title":1},"127":{"body":254,"breadcrumbs":3,"title":1},"128":{"body":17,"breadcrumbs":3,"title":1},"129":{"body":275,"breadcrumbs":3,"title":1},"13":{"body":25,"breadcrumbs":3,"title":1},"130":{"body":109,"breadcrumbs":3,"title":1},"131":{"body":249,"breadcrumbs":3,"title":1},"132":{"body":15,"breadcrumbs":3,"title":1},"133":{"body":18,"breadcrumbs":3,"title":1},"134":{"body":36,"breadcrumbs":3,"title":1},"135":{"body":57,"breadcrumbs":3,"title":1},"136":{"body":61,"breadcrumbs":3,"title":1},"137":{"body":287,"breadcrumbs":3,"title":1},"138":{"body":127,"breadcrumbs":3,"title":1},"139":{"body":312,"breadcrumbs":3,"title":1},"14":{"body":24,"breadcrumbs":3,"title":1},"140":{"body":9,"breadcrumbs":4,"title":2},"141":{"body":30,"breadcrumbs":6,"title":2},"142":{"body":12,"breadcrumbs":6,"title":2},"143":{"body":32,"breadcrumbs":5,"title":1},"144":{"body":12,"breadcrumbs":5,"title":1},"145":{"body":211,"breadcrumbs":6,"title":2},"146":{"body":116,"breadcrumbs":6,"title":2},"147":{"body":337,"breadcrumbs":6,"title":2},"148":{"body":67,"breadcrumbs":5,"title":1},"149":{"body":215,"breadcrumbs":5,"title":1},"15":{"body":52,"breadcrumbs":3,"title":1},"150":{"body":444,"breadcrumbs":5,"title":1},"151":{"body":198,"breadcrumbs":5,"title":1},"152":{"body":134,"breadcrumbs":5,"title":1},"153":{"body":24,"breadcrumbs":6,"title":2},"154":{"body":30,"breadcrumbs":5,"title":1},"155":{"body":2,"breadcrumbs":5,"title":1},"156":{"body":7,"breadcrumbs":6,"title":2},"157":{"body":24,"breadcrumbs":5,"title":1},"158":{"body":109,"breadcrumbs":6,"title":2},"159":{"body":119,"breadcrumbs":6,"title":2},"16":{"body":778,"breadcrumbs":3,"title":1},"160":{"body":146,"breadcrumbs":6,"title":2},"161":{"body":16,"breadcrumbs":6,"title":2},"162":{"body":21,"breadcrumbs":8,"title":4},"163":{"body":74,"breadcrumbs":8,"title":4},"164":{"body":48,"breadcrumbs":8,"title":4},"165":{"body":48,"breadcrumbs":9,"title":5},"166":{"body":110,"breadcrumbs":5,"title":1},"167":{"body":416,"breadcrumbs":7,"title":3},"168":{"body":101,"breadcrumbs":5,"title":1},"169":{"body":106,"breadcrumbs":5,"title":1},"17":{"body":572,"breadcrumbs":3,"title":1},"170":{"body":370,"breadcrumbs":5,"title":1},"171":{"body":26,"breadcrumbs":5,"title":1},"172":{"body":149,"breadcrumbs":5,"title":1},"173":{"body":31,"breadcrumbs":5,"title":1},"174":{"body":40,"breadcrumbs":5,"title":1},"175":{"body":14,"breadcrumbs":5,"title":1},"176":{"body":40,"breadcrumbs":5,"title":1},"177":{"body":243,"breadcrumbs":5,"title":1},"178":{"body":38,"breadcrumbs":5,"title":1},"179":{"body":182,"breadcrumbs":5,"title":1},"18":{"body":47,"breadcrumbs":3,"title":1},"180":{"body":706,"breadcrumbs":7,"title":3},"181":{"body":36,"breadcrumbs":4,"title":2},"19":{"body":475,"breadcrumbs":3,"title":1},"2":{"body":41,"breadcrumbs":2,"title":1},"20":{"body":586,"breadcrumbs":3,"title":1},"21":{"body":521,"breadcrumbs":3,"title":1},"22":{"body":126,"breadcrumbs":3,"title":1},"23":{"body":674,"breadcrumbs":5,"title":3},"24":{"body":109,"breadcrumbs":3,"title":1},"25":{"body":2,"breadcrumbs":4,"title":2},"26":{"body":170,"breadcrumbs":3,"title":1},"27":{"body":104,"breadcrumbs":3,"title":1},"28":{"body":2,"breadcrumbs":4,"title":2},"29":{"body":14,"breadcrumbs":3,"title":1},"3":{"body":48,"breadcrumbs":2,"title":1},"30":{"body":48,"breadcrumbs":3,"title":1},"31":{"body":72,"breadcrumbs":3,"title":1},"32":{"body":57,"breadcrumbs":3,"title":1},"33":{"body":3,"breadcrumbs":4,"title":2},"34":{"body":29,"breadcrumbs":3,"title":1},"35":{"body":85,"breadcrumbs":3,"title":1},"36":{"body":28,"breadcrumbs":3,"title":1},"37":{"body":30,"breadcrumbs":3,"title":1},"38":{"body":52,"breadcrumbs":3,"title":1},"39":{"body":61,"breadcrumbs":3,"title":1},"4":{"body":66,"breadcrumbs":4,"title":3},"40":{"body":10,"breadcrumbs":4,"title":2},"41":{"body":42,"breadcrumbs":3,"title":1},"42":{"body":207,"breadcrumbs":4,"title":2},"43":{"body":203,"breadcrumbs":5,"title":3},"44":{"body":121,"breadcrumbs":3,"title":1},"45":{"body":138,"breadcrumbs":3,"title":1},"46":{"body":118,"breadcrumbs":3,"title":1},"47":{"body":22,"breadcrumbs":3,"title":1},"48":{"body":25,"breadcrumbs":3,"title":1},"49":{"body":11,"breadcrumbs":3,"title":1},"5":{"body":35,"breadcrumbs":4,"title":3},"50":{"body":33,"breadcrumbs":3,"title":1},"51":{"body":12,"breadcrumbs":3,"title":1},"52":{"body":11,"breadcrumbs":3,"title":1},"53":{"body":5,"breadcrumbs":4,"title":2},"54":{"body":16,"breadcrumbs":3,"title":1},"55":{"body":57,"breadcrumbs":3,"title":1},"56":{"body":90,"breadcrumbs":3,"title":1},"57":{"body":126,"breadcrumbs":3,"title":1},"58":{"body":12,"breadcrumbs":3,"title":1},"59":{"body":105,"breadcrumbs":3,"title":1},"6":{"body":42,"breadcrumbs":3,"title":2},"60":{"body":17,"breadcrumbs":3,"title":1},"61":{"body":5,"breadcrumbs":5,"title":3},"62":{"body":9,"breadcrumbs":3,"title":1},"63":{"body":51,"breadcrumbs":3,"title":1},"64":{"body":44,"breadcrumbs":5,"title":3},"65":{"body":75,"breadcrumbs":3,"title":1},"66":{"body":70,"breadcrumbs":3,"title":1},"67":{"body":31,"breadcrumbs":3,"title":1},"68":{"body":15,"breadcrumbs":3,"title":1},"69":{"body":18,"breadcrumbs":3,"title":1},"7":{"body":38,"breadcrumbs":2,"title":1},"70":{"body":4,"breadcrumbs":3,"title":1},"71":{"body":98,"breadcrumbs":3,"title":1},"72":{"body":396,"breadcrumbs":3,"title":1},"73":{"body":59,"breadcrumbs":3,"title":1},"74":{"body":287,"breadcrumbs":3,"title":1},"75":{"body":2,"breadcrumbs":4,"title":2},"76":{"body":19,"breadcrumbs":3,"title":1},"77":{"body":165,"breadcrumbs":3,"title":1},"78":{"body":38,"breadcrumbs":3,"title":1},"79":{"body":36,"breadcrumbs":3,"title":1},"8":{"body":8,"breadcrumbs":3,"title":2},"80":{"body":60,"breadcrumbs":4,"title":2},"81":{"body":23,"breadcrumbs":3,"title":1},"82":{"body":98,"breadcrumbs":3,"title":1},"83":{"body":25,"breadcrumbs":3,"title":1},"84":{"body":24,"breadcrumbs":3,"title":1},"85":{"body":52,"breadcrumbs":3,"title":1},"86":{"body":26,"breadcrumbs":3,"title":1},"87":{"body":38,"breadcrumbs":3,"title":1},"88":{"body":778,"breadcrumbs":3,"title":1},"89":{"body":90,"breadcrumbs":3,"title":1},"9":{"body":16,"breadcrumbs":4,"title":3},"90":{"body":126,"breadcrumbs":3,"title":1},"91":{"body":72,"breadcrumbs":3,"title":1},"92":{"body":170,"breadcrumbs":3,"title":1},"93":{"body":104,"breadcrumbs":3,"title":1},"94":{"body":121,"breadcrumbs":3,"title":1},"95":{"body":572,"breadcrumbs":3,"title":1},"96":{"body":47,"breadcrumbs":3,"title":1},"97":{"body":475,"breadcrumbs":3,"title":1},"98":{"body":138,"breadcrumbs":3,"title":1},"99":{"body":118,"breadcrumbs":3,"title":1}},"docs":{"0":{"body":"This repository provides rules for building Rust projects with Bazel .","breadcrumbs":"Introduction » Rules Rust","id":"0","title":"Rules Rust"},"1":{"body":"The rules are released, and releases can be found on the GitHub Releases page . We recommend using the latest release from that page.","breadcrumbs":"Introduction » Setup","id":"1","title":"Setup"},"10":{"body":"You can also browse the full API in one page .","breadcrumbs":"Rules » Full API","id":"10","title":"Full API"},"100":{"body":"rust_shared_library(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name, crate_root, edition, experimental_use_cc_common_link, malloc, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, stamp, version) Builds a Rust shared library. This shared library will contain all transitively reachable crates and native objects. It is meant to be used when producing an artifact that is then consumed by some other build system (for example to produce a shared library that Python program links against). This rule provides CcInfo, so it can be used everywhere Bazel expects rules_cc. When building the whole binary in Bazel, use rust_library instead. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required deps List of other libraries to be linked to this library target.These can be either other rust_library targets or cc_library targets if linking a native library. List of labels optional [] srcs List of Rust .rs source files used to build the library.If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. List of labels optional [] data List of files used by this rule at compile time and runtime.If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. List of labels optional [] aliases Remap crates to a new name or moniker for linkage to this targetThese are other rust_library targets and will be presented as the new name given. Dictionary: Label -> String optional {} alwayslink If 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.This attribute is used by the C++ Starlark API when passing CcInfo providers. Boolean optional False compile_data List of files used by this rule at compile time.This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro. List of labels optional [] crate_features List of features to enable for this crate.Features are defined in the code using the #[cfg(feature = \"foo\")] configuration option. The features listed here will be passed to rustc with --cfg feature=\"${feature_name}\" flags. List of strings optional [] crate_name Crate name to use for this target.This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. String optional \"\" crate_root The file that will be passed to rustc to be used for building this crate.If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. Label optional None edition The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. String optional \"\" experimental_use_cc_common_link Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. Integer optional -1 malloc Override the default dependency on malloc.By default, Rust binaries linked with cc_common.link are linked against @bazel_tools//tools/cpp:malloc\", which is an empty library and the resulting binary will use libc's malloc. This label must refer to a cc_library rule. Label optional \"@bazel_tools//tools/cpp:malloc\" platform Optional platform to transition the shared library to. Label optional None proc_macro_deps List of rust_proc_macro targets used to help build this library target. List of labels optional [] rustc_env Dictionary of additional \"key\": \"value\" environment variables to set for rustc.rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. Dictionary: String -> String optional {} rustc_env_files Files containing additional environment variables to set for rustc.These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\\\).The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.Note that the variables here are subject to workspace status stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. List of labels optional [] rustc_flags List of compiler flags passed to rustc.These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). List of strings optional [] stamp Whether to encode build information into the Rustc action. Possible values:- stamp = 1: Always stamp the build information into the Rustc action, even in --nostamp builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.- stamp = 0: Always replace build information by constant values. This gives good build result caching.- stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.Stamped targets are not rebuilt unless their dependencies change.For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how cc_library.linkstamps behaves. Integer optional 0 version A version to inject in the cargo environment variable. String optional \"0.0.0\"","breadcrumbs":"Rules » all symbols » rust_shared_library","id":"100","title":"rust_shared_library"},"101":{"body":"rust_static_library(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name, crate_root, edition, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, stamp, version) Builds a Rust static library. This static library will contain all transitively reachable crates and native objects. It is meant to be used when producing an artifact that is then consumed by some other build system (for example to produce an archive that Python program links against). This rule provides CcInfo, so it can be used everywhere Bazel expects rules_cc. When building the whole binary in Bazel, use rust_library instead. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required deps List of other libraries to be linked to this library target.These can be either other rust_library targets or cc_library targets if linking a native library. List of labels optional [] srcs List of Rust .rs source files used to build the library.If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. List of labels optional [] data List of files used by this rule at compile time and runtime.If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. List of labels optional [] aliases Remap crates to a new name or moniker for linkage to this targetThese are other rust_library targets and will be presented as the new name given. Dictionary: Label -> String optional {} alwayslink If 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.This attribute is used by the C++ Starlark API when passing CcInfo providers. Boolean optional False compile_data List of files used by this rule at compile time.This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro. List of labels optional [] crate_features List of features to enable for this crate.Features are defined in the code using the #[cfg(feature = \"foo\")] configuration option. The features listed here will be passed to rustc with --cfg feature=\"${feature_name}\" flags. List of strings optional [] crate_name Crate name to use for this target.This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. String optional \"\" crate_root The file that will be passed to rustc to be used for building this crate.If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. Label optional None edition The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. String optional \"\" platform Optional platform to transition the static library to. Label optional None proc_macro_deps List of rust_proc_macro targets used to help build this library target. List of labels optional [] rustc_env Dictionary of additional \"key\": \"value\" environment variables to set for rustc.rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. Dictionary: String -> String optional {} rustc_env_files Files containing additional environment variables to set for rustc.These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\\\).The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.Note that the variables here are subject to workspace status stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. List of labels optional [] rustc_flags List of compiler flags passed to rustc.These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). List of strings optional [] stamp Whether to encode build information into the Rustc action. Possible values:- stamp = 1: Always stamp the build information into the Rustc action, even in --nostamp builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.- stamp = 0: Always replace build information by constant values. This gives good build result caching.- stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.Stamped targets are not rebuilt unless their dependencies change.For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how cc_library.linkstamps behaves. Integer optional 0 version A version to inject in the cargo environment variable. String optional \"0.0.0\"","breadcrumbs":"Rules » all symbols » rust_static_library","id":"101","title":"rust_static_library"},"102":{"body":"rust_stdlib_filegroup(name, srcs) A dedicated filegroup-like rule for Rust stdlib artifacts. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required srcs The list of targets/files that are components of the rust-stdlib file group List of labels required","breadcrumbs":"Rules » all symbols » rust_stdlib_filegroup","id":"102","title":"rust_stdlib_filegroup"},"103":{"body":"rust_test(name, deps, srcs, data, aliases, alwayslink, compile_data, crate, crate_features, crate_name, crate_root, edition, env, env_inherit, experimental_use_cc_common_link, malloc, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, stamp, use_libtest_harness, version) Builds a Rust test crate. Examples: Suppose you have the following directory structure for a Rust library crate with unit test code in the library sources: [workspace]/ WORKSPACE hello_lib/ BUILD src/ lib.rs hello_lib/src/lib.rs: pub struct Greeter { greeting: String,\n} impl Greeter { pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } pub fn greet(&self, thing: &str) -> String { format!(\"{} {}\", &self.greeting, thing) }\n} #[cfg(test)]\nmod test { use super::Greeter; #[test] fn test_greeting() { let hello = Greeter::new(\"Hi\"); assert_eq!(\"Hi Rust\", hello.greet(\"Rust\")); }\n} To build and run the tests, simply add a rust_test rule with no srcs and only depends on the hello_lib rust_library target via the crate attribute: hello_lib/BUILD: load(\"@rules_rust//rust:defs.bzl\", \"rust_library\", \"rust_test\") rust_library( name = \"hello_lib\", srcs = [\"src/lib.rs\"],\n) rust_test( name = \"hello_lib_test\", crate = \":hello_lib\", # You may add other deps that are specific to the test configuration deps = [\"//some/dev/dep\"],\n) Run the test with bazel test //hello_lib:hello_lib_test.","breadcrumbs":"Rules » all symbols » rust_test","id":"103","title":"rust_test"},"104":{"body":"Integration tests that live in the tests directory , they are essentially built as separate crates. Suppose you have the following directory structure where greeting.rs is an integration test for the hello_lib library crate: [workspace]/ WORKSPACE hello_lib/ BUILD src/ lib.rs tests/ greeting.rs hello_lib/tests/greeting.rs: extern crate hello_lib; use hello_lib; #[test]\nfn test_greeting() { let hello = greeter::Greeter::new(\"Hello\"); assert_eq!(\"Hello world\", hello.greeting(\"world\"));\n} To build the greeting.rs integration test, simply add a rust_test target with greeting.rs in srcs and a dependency on the hello_lib target: hello_lib/BUILD: load(\"@rules_rust//rust:defs.bzl\", \"rust_library\", \"rust_test\") rust_library( name = \"hello_lib\", srcs = [\"src/lib.rs\"],\n) rust_test( name = \"greeting_test\", srcs = [\"tests/greeting.rs\"], deps = [\":hello_lib\"],\n) Run the test with bazel test //hello_lib:greeting_test. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required deps List of other libraries to be linked to this library target.These can be either other rust_library targets or cc_library targets if linking a native library. List of labels optional [] srcs List of Rust .rs source files used to build the library.If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. List of labels optional [] data List of files used by this rule at compile time and runtime.If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. List of labels optional [] aliases Remap crates to a new name or moniker for linkage to this targetThese are other rust_library targets and will be presented as the new name given. Dictionary: Label -> String optional {} alwayslink If 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.This attribute is used by the C++ Starlark API when passing CcInfo providers. Boolean optional False compile_data List of files used by this rule at compile time.This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro. List of labels optional [] crate Target inline tests declared in the given crateThese tests are typically those that would be held out under #[cfg(test)] declarations. Label optional None crate_features List of features to enable for this crate.Features are defined in the code using the #[cfg(feature = \"foo\")] configuration option. The features listed here will be passed to rustc with --cfg feature=\"${feature_name}\" flags. List of strings optional [] crate_name Crate name to use for this target.This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. String optional \"\" crate_root The file that will be passed to rustc to be used for building this crate.If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. Label optional None edition The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. String optional \"\" env Specifies additional environment variables to set when the test is executed by bazel test. Values are subject to $(rootpath), $(execpath), location, and \"Make variable\" substitution. Dictionary: String -> String optional {} env_inherit Specifies additional environment variables to inherit from the external environment when the test is executed by bazel test. List of strings optional [] experimental_use_cc_common_link Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. Integer optional -1 malloc Override the default dependency on malloc.By default, Rust binaries linked with cc_common.link are linked against @bazel_tools//tools/cpp:malloc\", which is an empty library and the resulting binary will use libc's malloc. This label must refer to a cc_library rule. Label optional \"@bazel_tools//tools/cpp:malloc\" platform Optional platform to transition the test to. Label optional None proc_macro_deps List of rust_proc_macro targets used to help build this library target. List of labels optional [] rustc_env Dictionary of additional \"key\": \"value\" environment variables to set for rustc.rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. Dictionary: String -> String optional {} rustc_env_files Files containing additional environment variables to set for rustc.These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\\\).The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.Note that the variables here are subject to workspace status stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. List of labels optional [] rustc_flags List of compiler flags passed to rustc.These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). List of strings optional [] stamp Whether to encode build information into the Rustc action. Possible values:- stamp = 1: Always stamp the build information into the Rustc action, even in --nostamp builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.- stamp = 0: Always replace build information by constant values. This gives good build result caching.- stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.Stamped targets are not rebuilt unless their dependencies change.For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how cc_library.linkstamps behaves. Integer optional 0 use_libtest_harness Whether to use libtest. For targets using this flag, individual tests can be run by using the --test_arg flag. E.g. bazel test //src:rust_test --test_arg=foo::test::test_fn. Boolean optional True version A version to inject in the cargo environment variable. String optional \"0.0.0\"","breadcrumbs":"Rules » all symbols » Example: test directory","id":"104","title":"Example: test directory"},"105":{"body":"rust_toolchain(name, allocator_library, binary_ext, cargo, cargo_clippy, clippy_driver, debug_info, default_edition, dylib_ext, env, exec_triple, experimental_link_std_dylib, experimental_use_cc_common_link, extra_exec_rustc_flags, extra_rustc_flags, extra_rustc_flags_for_crate_types, global_allocator_library, llvm_cov, llvm_profdata, llvm_tools, opt_level, per_crate_rustc_flags, rust_doc, rust_std, rustc, rustc_lib, rustfmt, staticlib_ext, stdlib_linkflags, strip_level, target_json, target_triple) Declares a Rust toolchain for use. This is for declaring a custom toolchain, eg. for configuring a particular version of rust or supporting a new platform. Example: Suppose the core rust team has ported the compiler to a new target CPU, called cpuX. This support can be used in Bazel by defining a new toolchain definition and declaration: load('@rules_rust//rust:toolchain.bzl', 'rust_toolchain') rust_toolchain( name = \"rust_cpuX_impl\", binary_ext = \"\", dylib_ext = \".so\", exec_triple = \"cpuX-unknown-linux-gnu\", rust_doc = \"@rust_cpuX//:rustdoc\", rust_std = \"@rust_cpuX//:rust_std\", rustc = \"@rust_cpuX//:rustc\", rustc_lib = \"@rust_cpuX//:rustc_lib\", staticlib_ext = \".a\", stdlib_linkflags = [\"-lpthread\", \"-ldl\"], target_triple = \"cpuX-unknown-linux-gnu\",\n) toolchain( name = \"rust_cpuX\", exec_compatible_with = [ \"@platforms//cpu:cpuX\", \"@platforms//os:linux\", ], target_compatible_with = [ \"@platforms//cpu:cpuX\", \"@platforms//os:linux\", ], toolchain = \":rust_cpuX_impl\",\n) Then, either add the label of the toolchain rule to register_toolchains in the WORKSPACE, or pass it to the \"--extra_toolchains\" flag for Bazel, and it will be used. See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX repository with the actual binaries and libraries. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required allocator_library Target that provides allocator functions when rust_library targets are embedded in a cc_binary. Label optional \"@rules_rust//ffi/cc/allocator_library\" binary_ext The extension for binaries created from rustc. String required cargo The location of the cargo binary. Can be a direct source or a filegroup containing one item. Label optional None cargo_clippy The location of the cargo_clippy binary. Can be a direct source or a filegroup containing one item. Label optional None clippy_driver The location of the clippy-driver binary. Can be a direct source or a filegroup containing one item. Label optional None debug_info Rustc debug info levels per opt level Dictionary: String -> String optional {\"dbg\": \"2\", \"fastbuild\": \"0\", \"opt\": \"0\"} default_edition The edition to use for rust_* rules that don't specify an edition. If absent, every rule is required to specify its edition attribute. String optional \"\" dylib_ext The extension for dynamic libraries created from rustc. String required env Environment variables to set in actions. Dictionary: String -> String optional {} exec_triple The platform triple for the toolchains execution environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations String required experimental_link_std_dylib Label to a boolean build setting that controls whether whether to link libstd dynamically. Label optional \"@rules_rust//rust/settings:experimental_link_std_dylib\" experimental_use_cc_common_link Label to a boolean build setting that controls whether cc_common.link is used to link rust binaries. Label optional \"@rules_rust//rust/settings:experimental_use_cc_common_link\" extra_exec_rustc_flags Extra flags to pass to rustc in exec configuration List of strings optional [] extra_rustc_flags Extra flags to pass to rustc in non-exec configuration. Subject to location expansion with respect to the srcs of the rust_std attribute. List of strings optional [] extra_rustc_flags_for_crate_types Extra flags to pass to rustc based on crate type Dictionary: String -> List of strings optional {} global_allocator_library Target that provides allocator functions for when a global allocator is present. Label optional \"@rules_rust//ffi/cc/global_allocator_library\" llvm_cov The location of the llvm-cov binary. Can be a direct source or a filegroup containing one item. If None, rust code is not instrumented for coverage. Label optional None llvm_profdata The location of the llvm-profdata binary. Can be a direct source or a filegroup containing one item. If llvm_cov is None, this can be None as well and rust code is not instrumented for coverage. Label optional None llvm_tools LLVM tools that are shipped with the Rust toolchain. Label optional None opt_level Rustc optimization levels. Dictionary: String -> String optional {\"dbg\": \"0\", \"fastbuild\": \"0\", \"opt\": \"3\"} per_crate_rustc_flags Extra flags to pass to rustc in non-exec configuration List of strings optional [] rust_doc The location of the rustdoc binary. Can be a direct source or a filegroup containing one item. Label required rust_std The Rust standard library. Label required rustc The location of the rustc binary. Can be a direct source or a filegroup containing one item. Label required rustc_lib The libraries used by rustc during compilation. Label optional None rustfmt Deprecated : Instead see rustfmt_toolchain Label optional None staticlib_ext The extension for static libraries created from rustc. String required stdlib_linkflags Additional linker flags to use when Rust standard library is linked by a C++ linker (rustc will deal with these automatically). Subject to location expansion with respect to the srcs of the rust_std attribute. List of strings required strip_level Rustc strip levels. For all potential options, see https://doc.rust-lang.org/rustc/codegen-options/index.html#strip Dictionary: String -> String optional {\"dbg\": \"none\", \"fastbuild\": \"none\", \"opt\": \"debuginfo\"} target_json Override the target_triple with a custom target specification. For more details see: https://doc.rust-lang.org/rustc/targets/custom.html String optional \"\" target_triple The platform triple for the toolchains target environment. For more details see: https://docs.bazel.build/versions/master/skylark/rules.html#configurations String optional \"\"","breadcrumbs":"Rules » all symbols » rust_toolchain","id":"105","title":"rust_toolchain"},"106":{"body":"rust_wasm_bindgen(name, bindgen_flags, target, target_arch, wasm_file) Generates javascript and typescript bindings for a webassembly module using wasm-bindgen . An example of this rule in use can be seen at @rules_rust//examples/wasm ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required bindgen_flags Flags to pass directly to the bindgen executable. See https://github.com/rustwasm/wasm-bindgen/ for details. List of strings optional [] target The type of output to generate. See https://rustwasm.github.io/wasm-bindgen/reference/deployment.html for details. String optional \"bundler\" target_arch The target architecture to use for the wasm-bindgen command line option. String optional \"wasm32\" wasm_file The .wasm file or crate to generate bindings for. Label required","breadcrumbs":"Rules » all symbols » rust_wasm_bindgen","id":"106","title":"rust_wasm_bindgen"},"107":{"body":"rust_wasm_bindgen_toolchain(name, bindgen) The tools required for the rust_wasm_bindgen rule. In cases where users want to control or change the version of wasm-bindgen used by rust_wasm_bindgen , a unique toolchain can be created as in the example below: load(\"@rules_rust//bindgen:bindgen.bzl\", \"rust_bindgen_toolchain\") rust_bindgen_toolchain( bindgen = \"//3rdparty/crates:wasm_bindgen_cli__bin\",\n) toolchain( name = \"wasm_bindgen_toolchain\", toolchain = \"wasm_bindgen_toolchain_impl\", toolchain_type = \"@rules_rust//wasm_bindgen:toolchain_type\",\n) Now that you have your own toolchain, you need to register it by inserting the following statement in your WORKSPACE file: register_toolchains(\"//my/toolchains:wasm_bindgen_toolchain\") For additional information, see the Bazel toolchains documentation . ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required bindgen The label of a wasm-bindgen-cli executable. Label optional None","breadcrumbs":"Rules » all symbols » rust_wasm_bindgen_toolchain","id":"107","title":"rust_wasm_bindgen_toolchain"},"108":{"body":"rustfmt_test(name, targets) A test rule for performing rustfmt --check on a set of targets ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required targets Rust targets to run rustfmt --check on. List of labels optional []","breadcrumbs":"Rules » all symbols » rustfmt_test","id":"108","title":"rustfmt_test"},"109":{"body":"rustfmt_toolchain(name, rustc, rustc_lib, rustfmt) A toolchain for rustfmt ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required rustc The location of the rustc binary. Can be a direct source or a filegroup containing one item. Label optional None rustc_lib The libraries used by rustc during compilation. Label optional None rustfmt The location of the rustfmt binary. Can be a direct source or a filegroup containing one item. Label required","breadcrumbs":"Rules » all symbols » rustfmt_toolchain","id":"109","title":"rustfmt_toolchain"},"11":{"body":"rust_binary rust_library rust_library_group rust_static_library rust_shared_library rust_proc_macro rust_test rust_test_suite error_format extra_rustc_flag extra_rustc_flags capture_clippy_output","breadcrumbs":"Rules » rust » Rust","id":"11","title":"Rust"},"110":{"body":"CrateInfo(aliases, compile_data, compile_data_targets, data, deps, edition, is_test, metadata, name, output, owner, proc_macro_deps, root, rustc_env, rustc_env_files, rustc_output, rustc_rmeta_output, srcs, std_dylib, type, wrapped_crate_type) A provider containing general Crate information. FIELDS Name Description aliases Dict[Label, String]: Renamed and aliased crates compile_data depset[File]: Compile data required by this crate. compile_data_targets depset[Label]: Compile data targets required by this crate. data depset[File]: Compile data required by crates that use the current crate as a proc-macro. deps depset[DepVariantInfo]: This crate's (rust or cc) dependencies' providers. edition str: The edition of this crate. is_test bool: If the crate is being compiled in a test context metadata File: The output from rustc from producing the output file. It is optional. name str: The name of this crate. output File: The output File that will be produced, depends on crate type. owner Label: The label of the target that produced this CrateInfo proc_macro_deps depset[DepVariantInfo]: This crate's rust proc_macro dependencies' providers. root File: The source File entrypoint to this crate, eg. lib.rs rustc_env Dict[String, String]: Additional \"key\": \"value\" environment variables to set for rustc. rustc_env_files [File]: Files containing additional environment variables to set for rustc. rustc_output File: The output from rustc from producing the output file. It is optional. rustc_rmeta_output File: The rmeta file produced for this crate. It is optional. srcs depset[File]: All source Files that are part of the crate. std_dylib File: libstd.so file type str: The type of this crate (see rustc --crate-type ). wrapped_crate_type str, optional: The original crate type for targets generated using a previously defined crate (typically tests using the rust_test::crate attribute)","breadcrumbs":"Rules » all symbols » CrateInfo","id":"110","title":"CrateInfo"},"111":{"body":"DepInfo(dep_env, direct_crates, link_search_path_files, transitive_build_infos, transitive_crate_outputs, transitive_crates, transitive_data, transitive_metadata_outputs, transitive_noncrates, transitive_proc_macro_data) A provider containing information about a Crate's dependencies. FIELDS Name Description dep_env File: File with environment variables direct dependencies build scripts rely upon. direct_crates depset[AliasableDepInfo] link_search_path_files depset[File]: All transitive files containing search paths to pass to the linker transitive_build_infos depset[BuildInfo] transitive_crate_outputs depset[File]: All transitive crate outputs. transitive_crates depset[CrateInfo] transitive_data depset[File]: Data of all transitive non-macro dependencies. transitive_metadata_outputs depset[File]: All transitive metadata dependencies (.rmeta, for crates that provide them) and all transitive object dependencies (.rlib) for crates that don't provide metadata. transitive_noncrates depset[LinkerInput]: All transitive dependencies that aren't crates. transitive_proc_macro_data depset[File]: Data of all transitive proc-macro dependencies, and non-macro dependencies of those macros.","breadcrumbs":"Rules » all symbols » DepInfo","id":"111","title":"DepInfo"},"112":{"body":"RustWasmBindgenInfo(js, ts, wasm) Info about wasm-bindgen outputs. FIELDS Name Description js Depset[File]: The Javascript files produced by wasm-bindgen. ts Depset[File]: The Typescript files produced by wasm-bindgen. wasm File: The .wasm file generated by wasm-bindgen.","breadcrumbs":"Rules » all symbols » RustWasmBindgenInfo","id":"112","title":"RustWasmBindgenInfo"},"113":{"body":"StdLibInfo(alloc_files, between_alloc_and_core_files, between_core_and_std_files, core_files, dot_a_files, memchr_files, panic_files, self_contained_files, srcs, std_dylib, std_files, std_rlibs, test_files) A collection of files either found within the rust-stdlib artifact or generated based on existing files. FIELDS Name Description alloc_files List[File]: .a files related to the alloc module. between_alloc_and_core_files List[File]: .a files related to the compiler_builtins module. between_core_and_std_files List[File]: .a files related to all modules except adler, alloc, compiler_builtins, core, and std. core_files List[File]: .a files related to the core and adler modules dot_a_files Depset[File]: Generated .a files memchr_files Depset[File]: .a files associated with the memchr module. panic_files Depset[File]: .a files associated with panic_unwind and panic_abort. self_contained_files List[File]: All .o files from the self-contained directory. srcs List[Target]: All targets from the original srcs attribute. std_dylib File: libstd.so file std_files Depset[File]: .a files associated with the std module. std_rlibs List[File]: All .rlib files test_files Depset[File]: .a files associated with the test module.","breadcrumbs":"Rules » all symbols » StdLibInfo","id":"113","title":"StdLibInfo"},"114":{"body":"cargo_build_script(name, edition, crate_name, crate_root, srcs, crate_features, version, deps, link_deps, proc_macro_deps, build_script_env, data, compile_data, tools, links, rundir, rustc_env, rustc_env_files, rustc_flags, visibility, tags, aliases, pkg_name, kwargs) Compile and execute a rust build script to generate build attributes This rules take the same arguments as rust_binary. Example: Suppose you have a crate with a cargo build script build.rs: [workspace]/ hello_lib/ BUILD build.rs src/ lib.rs Then you want to use the build script in the following: hello_lib/BUILD: package(default_visibility = [\"//visibility:public\"]) load(\"@rules_rust//rust:defs.bzl\", \"rust_binary\", \"rust_library\")\nload(\"@rules_rust//cargo:defs.bzl\", \"cargo_build_script\") # This will run the build script from the root of the workspace, and\n# collect the outputs.\ncargo_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\"],\n) rust_library( name = \"hello_lib\", srcs = [ \"src/lib.rs\", ], deps = [\":build_script\"],\n) The hello_lib target will be build with the flags and the environment variables declared by the build script in addition to the file generated by it. PARAMETERS Name Description Default Value name The name for the underlying rule. This should be the name of the package being compiled, optionally with a suffix of _bs. Otherwise, you can set the package name via pkg_name. none edition The rust edition to use for the internal binary crate. None crate_name Crate name to use for build script. None crate_root The file that will be passed to rustc to be used for building this crate. None srcs Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made. [] crate_features A list of features to enable for the build script. [] version The semantic version (semver) of the crate. None deps The build-dependencies of the crate. [] link_deps The subset of the (normal) dependencies of the crate that have the links attribute and therefore provide environment variables to this build script. [] proc_macro_deps List of rust_proc_macro targets used to build the script. [] build_script_env Environment variables for build scripts. {} data Files needed by the build script. [] compile_data Files needed for the compilation of the build script. [] tools Tools (executables) needed by the build script. [] links Name of the native library this crate links against. None rundir A directory to cd to before the cargo_build_script is run. This should be a path relative to the exec root.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.If set to ., the cargo build script will run in the exec root. None rustc_env Environment variables to set in rustc when compiling the build script. {} rustc_env_files Files containing additional environment variables to set for rustc when building the build script. [] rustc_flags List of compiler flags passed to rustc. [] visibility Visibility to apply to the generated build script output. None tags (list of str, optional): Tags to apply to the generated build script output. None aliases Remap crates to a new name or moniker for linkage to this target. These are other rust_library targets and will be presented as the new name given. None pkg_name Override the package name used for the build script. This is useful if the build target name gets too long otherwise. None kwargs Forwards to the underlying rust_binary rule. An exception is the compatible_with attribute, which shouldn't be forwarded to the rust_binary, as the rust_binary is only built and used in exec mode. We propagate the compatible_with attribute to the _build_scirpt_run target. none","breadcrumbs":"Rules » all symbols » cargo_build_script","id":"114","title":"cargo_build_script"},"115":{"body":"cargo_env(env) A helper for generating platform specific environment variables load(\"@rules_rust//rust:defs.bzl\", \"rust_common\")\nload(\"@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\", }), }\n) PARAMETERS Name Description Default Value env A map of environment variables none RETURNS str: A json encoded string of the environment variables","breadcrumbs":"Rules » all symbols » cargo_env","id":"115","title":"cargo_env"},"116":{"body":"rules_rust_dependencies() Dependencies used in the implementation of rules_rust.","breadcrumbs":"Rules » all symbols » rules_rust_dependencies","id":"116","title":"rules_rust_dependencies"},"117":{"body":"rust_analyzer_toolchain_repository(name, version, exec_compatible_with, target_compatible_with, sha256s, urls, auth, netrc, auth_patterns) Assemble a remote rust_analyzer_toolchain target based on the given params. PARAMETERS Name Description Default Value name The name of the toolchain proxy repository contianing the registerable toolchain. none version The version of the tool among \"nightly\", \"beta', or an exact version. none exec_compatible_with A list of constraints for the execution platform for this toolchain. [] target_compatible_with A list of constraints for the target platform for this toolchain. [] sha256s A dict associating tool subdirectories to sha256 hashes. See rust_register_toolchains for more details. None urls A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz'] None auth Auth object compatible with repository_ctx.download to use when downloading files. See repository_ctx.download for more details. None netrc .netrc file to use for authentication; mirrors the eponymous attribute from http_archive None auth_patterns Override mapping of hostnames to authorization patterns; mirrors the eponymous attribute from http_archive None RETURNS str: The name of a registerable rust_analyzer_toolchain.","breadcrumbs":"Rules » all symbols » rust_analyzer_toolchain_repository","id":"117","title":"rust_analyzer_toolchain_repository"},"118":{"body":"rust_bindgen_dependencies() Declare dependencies needed for bindgen. RETURNS list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories defined by this macro.","breadcrumbs":"Rules » all symbols » rust_bindgen_dependencies","id":"118","title":"rust_bindgen_dependencies"},"119":{"body":"rust_bindgen_library(name, header, cc_lib, bindgen_flags, bindgen_features, clang_flags, wrap_static_fns, kwargs) Generates a rust source file for header, and builds a rust_library. Arguments are the same as rust_bindgen, and kwargs are passed directly to rust_library. PARAMETERS Name Description Default Value name A unique name for this target. none header The label of the .h file to generate bindings for. none cc_lib The label of the cc_library that contains the .h file. This is used to find the transitive includes. none bindgen_flags Flags to pass directly to the bindgen executable. See https://rust-lang.github.io/rust-bindgen/ for details. None bindgen_features The features attribute for the rust_bindgen target. None clang_flags Flags to pass directly to the clang executable. None wrap_static_fns Whether to create a separate .c file for static fns. Requires nightly toolchain, and a header that actually needs this feature (otherwise bindgen won't generate the file and Bazel complains\", False kwargs Arguments to forward to the underlying rust_library rule. none","breadcrumbs":"Rules » all symbols » rust_bindgen_library","id":"119","title":"rust_bindgen_library"},"12":{"body":"capture_clippy_output(name) Control whether to print clippy output or store it to a file, using the configured error_format. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » rust » capture_clippy_output","id":"12","title":"capture_clippy_output"},"120":{"body":"rust_bindgen_register_toolchains(register_toolchains) Registers the default toolchains for the rules_rust bindgen rules. PARAMETERS Name Description Default Value register_toolchains Whether or not to register toolchains. True","breadcrumbs":"Rules » all symbols » rust_bindgen_register_toolchains","id":"120","title":"rust_bindgen_register_toolchains"},"121":{"body":"rust_prost_dependencies(bzlmod) Declares repositories needed for prost. PARAMETERS Name Description Default Value bzlmod Whether bzlmod is enabled. False RETURNS list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories defined by this macro.","breadcrumbs":"Rules » all symbols » rust_prost_dependencies","id":"121","title":"rust_prost_dependencies"},"122":{"body":"rust_prost_library(name, kwargs) A rule for generating a Rust library using Prost. PARAMETERS Name Description Default Value name The name of the target. none kwargs Additional keyword arguments for the underlying rust_prost_library rule. none","breadcrumbs":"Rules » all symbols » rust_prost_library","id":"122","title":"rust_prost_library"},"123":{"body":"rust_prost_transitive_repositories() Load transitive dependencies of the @rules_rust//proto/protobuf rules. This macro should be called immediately after the rust_protobuf_dependencies macro.","breadcrumbs":"Rules » all symbols » rust_prost_transitive_repositories","id":"123","title":"rust_prost_transitive_repositories"},"124":{"body":"rust_proto_protobuf_dependencies(bzlmod) Sets up dependencies for rules_rust's proto support. PARAMETERS Name Description Default Value bzlmod Whether this function is being called from a bzlmod context rather than a workspace context. False RETURNS A list of structs containing information about root module deps to report to bzlmod's extension_metadata.","breadcrumbs":"Rules » all symbols » rust_proto_protobuf_dependencies","id":"124","title":"rust_proto_protobuf_dependencies"},"125":{"body":"rust_proto_protobuf_register_toolchains(register_toolchains) Register toolchains for proto compilation. PARAMETERS Name Description Default Value register_toolchains - True","breadcrumbs":"Rules » all symbols » rust_proto_protobuf_register_toolchains","id":"125","title":"rust_proto_protobuf_register_toolchains"},"126":{"body":"rust_proto_protobuf_transitive_repositories() Load transitive dependencies of the @rules_rust//proto/protobuf rules. This macro should be called immediately after the rust_protobuf_dependencies macro.","breadcrumbs":"Rules » all symbols » rust_proto_protobuf_transitive_repositories","id":"126","title":"rust_proto_protobuf_transitive_repositories"},"127":{"body":"rust_register_toolchains(dev_components, edition, allocator_library, global_allocator_library, register_toolchains, rustfmt_version, rust_analyzer_version, sha256s, extra_target_triples, extra_rustc_flags, extra_exec_rustc_flags, urls, versions) Emits a default set of toolchains for Linux, MacOS, and Freebsd Skip this macro and call the rust_repository_set macros directly if you need a compiler for other hosts or for additional target triples. The sha256s attribute represents a dict associating tool subdirectories to sha256 hashes. As an example: { \"rust-1.46.0-x86_64-unknown-linux-gnu\": \"e3b98bc3440fe92817881933f9564389eccb396f5f431f33d48b979fa2fbdcf5\", \"rustfmt-1.4.12-x86_64-unknown-linux-gnu\": \"1894e76913303d66bf40885a601462844eec15fca9e76a6d13c390d7000d64b0\", \"rust-std-1.46.0-x86_64-unknown-linux-gnu\": \"ac04aef80423f612c0079829b504902de27a6997214eb58ab0765d02f7ec1dbc\",\n} This would match for exec_triple = \"x86_64-unknown-linux-gnu\". If not specified, rules_rust pulls from a non-exhaustive list of known checksums.. See load_arbitrary_tool in @rules_rust//rust:repositories.bzl for more details. PARAMETERS Name Description Default Value dev_components Whether to download the rustc-dev components (defaults to False). Requires version to be \"nightly\". False edition The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its edition attribute. None allocator_library Target that provides allocator functions when rust_library targets are embedded in a cc_binary. None global_allocator_library Target that provides allocator functions when global allocator is used with cc_common.link. None register_toolchains If true, repositories will be generated to produce and register rust_toolchain targets. True rustfmt_version The version of rustfmt. If none is supplied and only a single version in versions is given, then this defaults to that version, otherwise will default to the default nightly version. None rust_analyzer_version The version of Rustc to pair with rust-analyzer. None sha256s A dict associating tool subdirectories to sha256 hashes. None extra_target_triples Additional rust-style targets that rust toolchains should support. [\"wasm32-unknown-unknown\", \"wasm32-wasip1\"] extra_rustc_flags Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration. None extra_exec_rustc_flags Extra flags to pass to rustc in exec configuration. None urls A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). [\"https://static.rust-lang.org/dist/{}.tar.xz\"] versions A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. [\"1.65.0\", \"nightly/2022-11-02\", \"beta/2020-12-30\"]. [\"1.82.0\", \"nightly/2024-10-17\"]","breadcrumbs":"Rules » all symbols » rust_register_toolchains","id":"127","title":"rust_register_toolchains"},"128":{"body":"rust_repositories(kwargs) Deprecated : Use rules_rust_dependencies and rust_register_toolchains directly. PARAMETERS Name Description Default Value kwargs Keyword arguments for the rust_register_toolchains macro. none","breadcrumbs":"Rules » all symbols » rust_repositories","id":"128","title":"rust_repositories"},"129":{"body":"rust_repository_set(name, versions, exec_triple, target_settings, allocator_library, global_allocator_library, extra_target_triples, rustfmt_version, edition, dev_components, extra_rustc_flags, extra_exec_rustc_flags, opt_level, sha256s, urls, auth, netrc, auth_patterns, register_toolchain, exec_compatible_with, default_target_compatible_with) Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains. PARAMETERS Name Description Default Value name The name of the generated repository none versions A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. [\"1.65.0\", \"nightly/2022-11-02\", \"beta/2020-12-30\"]. none exec_triple The Rust-style target that this compiler runs on none target_settings A list of config_settings that must be satisfied by the target configuration in order for this set of toolchains to be selected during toolchain resolution. [] allocator_library Target that provides allocator functions when rust_library targets are embedded in a cc_binary. None global_allocator_library Target that provides allocator functions a global allocator is used with cc_common.link. None extra_target_triples Additional rust-style targets that this set of toolchains should support. If a map, values should be (optional) target_compatible_with lists for that particular target triple. {} rustfmt_version The version of rustfmt to be associated with the toolchain. None edition The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. None dev_components Whether to download the rustc-dev components. Requires version to be \"nightly\". False extra_rustc_flags Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration. None extra_exec_rustc_flags Extra flags to pass to rustc in exec configuration. None opt_level Dictionary of target triples to optimiztion config. None sha256s A dict associating tool subdirectories to sha256 hashes. See rust_register_toolchains for more details. None urls A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). [\"https://static.rust-lang.org/dist/{}.tar.xz\"] auth Auth object compatible with repository_ctx.download to use when downloading files. See repository_ctx.download for more details. None netrc .netrc file to use for authentication; mirrors the eponymous attribute from http_archive None auth_patterns Override mapping of hostnames to authorization patterns; mirrors the eponymous attribute from http_archive None register_toolchain If True, the generated rust_toolchain target will become a registered toolchain. True exec_compatible_with A list of constraints for the execution platform for this toolchain. None default_target_compatible_with A list of constraints for the target platform for this toolchain when the exec platform is the same as the target platform. None","breadcrumbs":"Rules » all symbols » rust_repository_set","id":"129","title":"rust_repository_set"},"13":{"body":"error_format(name) Change the --error-format flag from the command line with --@rules_rust//:error_format. See rustc documentation for valid values. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » rust » error_format","id":"13","title":"error_format"},"130":{"body":"rust_test_suite(name, srcs, shared_srcs, kwargs) A rule for creating a test suite for a set of rust_test targets. This rule can be used for setting up typical rust integration tests . Given the following directory structure: [crate]/ BUILD.bazel src/ lib.rs main.rs tests/ integrated_test_a.rs integrated_test_b.rs integrated_test_c.rs patterns/ fibonacci_test.rs helpers/ mod.rs The rule can be used to generate rust_test targets for each source file under tests and a test_suite which encapsulates all tests. load(\"//rust:defs.bzl\", \"rust_binary\", \"rust_library\", \"rust_test_suite\") rust_library( name = \"math_lib\", srcs = [\"src/lib.rs\"],\n) rust_binary( name = \"math_bin\", srcs = [\"src/main.rs\"],\n) rust_test_suite( name = \"integrated_tests_suite\", srcs = glob([\"tests/**\"]), shared_srcs=glob([\"tests/helpers/**\"]), deps = [\":math_lib\"],\n) PARAMETERS Name Description Default Value name The name of the test_suite. none srcs All test sources, typically glob([\"tests/**/*.rs\"]). none shared_srcs Optional argument for sources shared among tests, typically helper functions. [] kwargs Additional keyword arguments for the underyling rust_test targets. The tags argument is also passed to the generated test_suite target. none","breadcrumbs":"Rules » all symbols » rust_test_suite","id":"130","title":"rust_test_suite"},"131":{"body":"rust_toolchain_repository(name, version, exec_triple, target_triple, exec_compatible_with, target_compatible_with, target_settings, channel, allocator_library, global_allocator_library, rustfmt_version, edition, dev_components, extra_rustc_flags, extra_exec_rustc_flags, opt_level, sha256s, urls, auth, netrc, auth_patterns) Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains. PARAMETERS Name Description Default Value name The name of the generated repository none version The version of the tool among \"nightly\", \"beta\", or an exact version. none exec_triple The Rust-style target that this compiler runs on. none target_triple The Rust-style target to build for. none exec_compatible_with A list of constraints for the execution platform for this toolchain. None target_compatible_with A list of constraints for the target platform for this toolchain. None target_settings A list of config_settings that must be satisfied by the target configuration in order for this toolchain to be selected during toolchain resolution. [] channel The channel of the Rust toolchain. None allocator_library Target that provides allocator functions when rust_library targets are embedded in a cc_binary. None global_allocator_library Target that provides allocator functions when a global allocator is used with cc_common.link. None rustfmt_version The version of rustfmt to be associated with the toolchain. None edition The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. None dev_components Whether to download the rustc-dev components. Requires version to be \"nightly\". Defaults to False. False extra_rustc_flags Extra flags to pass to rustc in non-exec configuration. None extra_exec_rustc_flags Extra flags to pass to rustc in exec configuration. None opt_level Optimization level config for this toolchain. None sha256s A dict associating tool subdirectories to sha256 hashes. See rust_register_toolchains for more details. None urls A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). Defaults to ['https://static.rust-lang.org/dist/{}.tar.xz'] [\"https://static.rust-lang.org/dist/{}.tar.xz\"] auth Auth object compatible with repository_ctx.download to use when downloading files. See repository_ctx.download for more details. None netrc .netrc file to use for authentication; mirrors the eponymous attribute from http_archive None auth_patterns A list of patterns to match against urls for which the auth object should be used. None RETURNS str: The name of the registerable toolchain created by this rule.","breadcrumbs":"Rules » all symbols » rust_toolchain_repository","id":"131","title":"rust_toolchain_repository"},"132":{"body":"rust_wasm_bindgen_dependencies() Declare dependencies needed for the rules_rust wasm-bindgen rules. RETURNS list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories defined by this macro.","breadcrumbs":"Rules » all symbols » rust_wasm_bindgen_dependencies","id":"132","title":"rust_wasm_bindgen_dependencies"},"133":{"body":"rust_wasm_bindgen_register_toolchains(register_toolchains) Registers the default toolchains for the rules_rust wasm-bindgen rules. PARAMETERS Name Description Default Value register_toolchains Whether or not to register toolchains. True","breadcrumbs":"Rules » all symbols » rust_wasm_bindgen_register_toolchains","id":"133","title":"rust_wasm_bindgen_register_toolchains"},"134":{"body":"rust_analyzer_aspect(name) Annotates rust rules with RustAnalyzerInfo later used to build a rust-project.json ASPECT ATTRIBUTES Name Type deps String proc_macro_deps String crate String actual String proto String ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » all symbols » rust_analyzer_aspect","id":"134","title":"rust_analyzer_aspect"},"135":{"body":"rust_clippy_aspect(name) Executes the clippy checker on specified targets. This aspect applies to existing rust_library, rust_test, and rust_binary rules. As an example, if the following is defined in examples/hello_lib/BUILD.bazel: load(\"@rules_rust//rust:defs.bzl\", \"rust_library\", \"rust_test\") rust_library( name = \"hello_lib\", srcs = [\"src/lib.rs\"],\n) rust_test( name = \"greeting_test\", srcs = [\"tests/greeting.rs\"], deps = [\":hello_lib\"],\n) Then the targets can be analyzed with clippy using the following command: $ bazel build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect --output_groups=clippy_checks //hello_lib:all ASPECT ATTRIBUTES ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » all symbols » rust_clippy_aspect","id":"135","title":"rust_clippy_aspect"},"136":{"body":"rustfmt_aspect(name) This aspect is used to gather information about a crate for use in rustfmt and perform rustfmt checks Output Groups: rustfmt_checks: Executes rustfmt --check on the specified target. The build setting @rules_rust//:rustfmt.toml is used to control the Rustfmt configuration settings used at runtime. This aspect is executed on any target which provides the CrateInfo provider. However users may tag a target with no-rustfmt or no-format to have it skipped. Additionally, generated source files are also ignored by this aspect. ASPECT ATTRIBUTES ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » all symbols » rustfmt_aspect","id":"136","title":"rustfmt_aspect"},"137":{"body":"cargo_bootstrap_repository(name, srcs, binary, build_mode, cargo_lockfile, cargo_toml, env, env_label, repo_mapping, rust_toolchain_cargo_template, rust_toolchain_rustc_template, timeout, version) A rule for bootstrapping a Rust binary using Cargo ATTRIBUTES Name Description Type Mandatory Default name A unique name for this repository. Name required srcs Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made List of labels optional [] binary The binary to build (the --bin parameter for Cargo). If left empty, the repository name will be used. String optional \"\" build_mode The build mode the binary should be built with String optional \"release\" cargo_lockfile The lockfile of the crate_universe resolver Label required cargo_toml The path of the crate_universe resolver manifest (Cargo.toml file) Label required env A mapping of platform triple to a set of environment variables. See cargo_env for usage details. Additionally, the platform triple * applies to all platforms. Dictionary: String -> String optional {} env_label A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See cargo_env for usage details. Additionally, the platform triple * applies to all platforms. Dictionary: String -> String optional {} repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.For example, an entry \"@foo\": \"@bar\" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function). Dictionary: String -> String optional rust_toolchain_cargo_template The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. String optional \"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}\" rust_toolchain_rustc_template The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. String optional \"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}\" timeout Maximum duration of the Cargo build command in seconds Integer optional 600 version The version of Rust the currently registered toolchain is using. Eg. 1.56.0, or nightly/2021-09-08 String optional \"1.82.0\"","breadcrumbs":"Rules » all symbols » cargo_bootstrap_repository","id":"137","title":"cargo_bootstrap_repository"},"138":{"body":"rust_toolchain_repository_proxy(name, exec_compatible_with, repo_mapping, target_compatible_with, target_settings, toolchain, toolchain_type) Generates a toolchain-bearing repository that declares the toolchains from some other rust_toolchain_repository. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this repository. Name required exec_compatible_with A list of constraints for the execution platform for this toolchain. List of strings optional [] repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.For example, an entry \"@foo\": \"@bar\" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function). Dictionary: String -> String optional target_compatible_with A list of constraints for the target platform for this toolchain. List of strings optional [] target_settings A list of config_settings that must be satisfied by the target configuration in order for this toolchain to be selected during toolchain resolution. List of strings optional [] toolchain The name of the toolchain implementation target. String required toolchain_type The toolchain type of the toolchain to declare String required","breadcrumbs":"Rules » all symbols » rust_toolchain_repository_proxy","id":"138","title":"rust_toolchain_repository_proxy"},"139":{"body":"rust_toolchain_tools_repository(name, allocator_library, auth, auth_patterns, dev_components, edition, exec_triple, extra_exec_rustc_flags, extra_rustc_flags, global_allocator_library, netrc, opt_level, repo_mapping, rustfmt_version, sha256s, target_triple, urls, version) Composes a single workspace containing the toolchain components for compiling on a given platform to a series of target platforms. A given instance of this rule should be accompanied by a toolchain_repository_proxy invocation to declare its toolchains to Bazel; the indirection allows separating toolchain selection from toolchain fetching. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this repository. Name required allocator_library Target that provides allocator functions when rust_library targets are embedded in a cc_binary. String optional \"@rules_rust//ffi/cc/allocator_library\" auth Auth object compatible with repository_ctx.download to use when downloading files. See repository_ctx.download for more details. Dictionary: String -> String optional {} auth_patterns A list of patterns to match against urls for which the auth object should be used. List of strings optional [] dev_components Whether to download the rustc-dev components (defaults to False). Requires version to be \"nightly\". Boolean optional False edition The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its edition attribute. String optional \"\" exec_triple The Rust-style target that this compiler runs on String required extra_exec_rustc_flags Extra flags to pass to rustc in exec configuration List of strings optional [] extra_rustc_flags Extra flags to pass to rustc in non-exec configuration List of strings optional [] global_allocator_library Target that provides allocator functions when a global allocator is used with cc_common.link. String optional \"@rules_rust//ffi/cc/global_allocator_library\" netrc .netrc file to use for authentication; mirrors the eponymous attribute from http_archive String optional \"\" opt_level Rustc optimization levels. For more details see the documentation for rust_toolchain.opt_level. Dictionary: String -> String optional {} repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.For example, an entry \"@foo\": \"@bar\" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function). Dictionary: String -> String optional rustfmt_version The version of the tool among \"nightly\", \"beta\", or an exact version. String optional \"\" sha256s A dict associating tool subdirectories to sha256 hashes. See rust_register_toolchains for more details. Dictionary: String -> String optional {} target_triple The Rust-style target that this compiler builds for. String required urls A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). List of strings optional [\"https://static.rust-lang.org/dist/{}.tar.xz\"] version The version of the tool among \"nightly\", \"beta\", or an exact version. String required","breadcrumbs":"Rules » all symbols » rust_toolchain_tools_repository","id":"139","title":"rust_toolchain_tools_repository"},"14":{"body":"extra_rustc_flag(name) Add additional rustc_flag from the command line with --@rules_rust//:extra_rustc_flag. Multiple uses are accumulated and appended after the extra_rustc_flags. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » rust » extra_rustc_flag","id":"14","title":"extra_rustc_flag"},"140":{"body":"crate_universe ( crate_universe bzlmod ) is a tool built into rules_rust that can be used to fetch dependencies.","breadcrumbs":"External Crates » External Dependencies","id":"140","title":"External Dependencies"},"141":{"body":"Crate Universe is a set of Bazel rule for generating Rust targets using Cargo. This doc describes using crate_universe with bzlmod. If you're using a WORKSPACE file, please see the WORKSPACE equivalent of this doc . There are some examples of using crate_universe with bzlmod in the example folder .","breadcrumbs":"External Crates » crate_universe (bzlmod) » Crate Universe","id":"141","title":"Crate Universe"},"142":{"body":"Setup Dependencies Cargo Workspace Direct Packages Vendored Dependencies Crate reference from_cargo from_specs","breadcrumbs":"External Crates » crate_universe (bzlmod) » Table of Contents","id":"142","title":"Table of Contents"},"143":{"body":"To use rules_rust in a project using bzlmod, add the following to your MODULE.bazel file: bazel_dep(name = \"rules_rust\", version = \"0.49.3\") You find the latest version on the release page . After adding rules_rust in your MODULE.bazel, set the following to begin using crate_universe: crate = use_extension(\"@rules_rust//crate_universe:extension.bzl\", \"crate\")\n// # ... Dependencies\nuse_repo(crate, \"crates\")","breadcrumbs":"External Crates » crate_universe (bzlmod) » Setup","id":"143","title":"Setup"},"144":{"body":"There are three different ways to declare dependencies in your MODULE. Cargo workspace Direct Dependencies Vendored Dependencies","breadcrumbs":"External Crates » crate_universe (bzlmod) » Dependencies","id":"144","title":"Dependencies"},"145":{"body":"One of the simpler ways to wire up dependencies would be to first structure your project into a Cargo workspace. The crates_repository rule can ingest a root Cargo.toml file and generate Bazel dependencies from there. You find a complete example in the in the example folder . crate = use_extension(\"@rules_rust//crate_universe:extension.bzl\", \"crate\") crate.from_cargo( name = \"crates\", cargo_lockfile = \"//:Cargo.lock\", manifests = [\"//:Cargo.toml\"],\n)\nuse_repo(crate, \"crates\") The generated crates_repository contains helper macros which make collecting dependencies for Bazel targets simpler. Notably, the all_crate_deps and aliases macros ( see Dependencies API ) commonly allow the Cargo.toml files to be the single source of truth for dependencies. Since these macros come from the generated repository, the dependencies and alias definitions they return will automatically update BUILD targets. In your BUILD files, you use these macros for a Rust library as shown below: load(\"@crate_index//:defs.bzl\", \"aliases\", \"all_crate_deps\")\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\", \"rust_test\") rust_library( name = \"lib\", aliases = aliases(), deps = all_crate_deps( normal = True, ), proc_macro_deps = all_crate_deps( proc_macro = True, ),\n) rust_test( name = \"unit_test\", crate = \":lib\", aliases = aliases( normal_dev = True, proc_macro_dev = True, ), deps = all_crate_deps( normal_dev = True, ), proc_macro_deps = all_crate_deps( proc_macro_dev = True, ),\n) For a Rust binary that does not depend on any macro, use the following configuration in your build file: rust_binary( name = \"bin\", srcs = [\"src/main.rs\"], deps = all_crate_deps(normal = True),\n) You have to repin before your first build to ensure all Bazel targets for the macros are generated. Dependency syncing and updating is done in the repository rule which means it's done during the analysis phase of builds. As mentioned in the environments variable table above, the CARGO_BAZEL_REPIN (or REPIN) environment variables can be used to force the rule to update dependencies and potentially render a new lockfile. Given an instance of this repository rule named crates, the easiest way to repin dependencies is to run: CARGO_BAZEL_REPIN=1 bazel sync --only=crates This will result in all dependencies being updated for a project. The CARGO_BAZEL_REPIN environment variable can also be used to customize how dependencies are updated. For more details about repin, please refer to the documentation .","breadcrumbs":"External Crates » crate_universe (bzlmod) » Cargo Workspaces","id":"145","title":"Cargo Workspaces"},"146":{"body":"In cases where Rust targets have heavy interactions with other Bazel targets ( Cc , Proto , etc.), maintaining Cargo.toml files may have diminishing returns as things like rust-analyzer begin to be confused about missing targets or environment variables defined only in Bazel. In situations like this, it may be desirable to have a “Cargo free” setup. You find an example in the in the example folder . crates_repository supports this through the packages attribute, as shown below. crate = use_extension(\"@rules_rust//crate_universe:extension.bzl\", \"crate\") crate.spec(package = \"serde\", features = [\"derive\"], version = \"1.0\")\ncrate.spec(package = \"serde_json\", version = \"1.0\")\ncrate.spec(package = \"tokio\", default_features=False, features = [\"macros\", \"net\", \"rt-multi-thread\"], version = \"1.38\") crate.from_specs()\nuse_repo(crate, \"crates\") Consuming dependencies may be more ergonomic in this case through the aliases defined in the new repository. In your BUILD files, you use direct dependencies as shown below: rust_binary( name = \"bin\", crate_root = \"src/main.rs\", srcs = glob([ \"src/*.rs\", ]), deps = [ # External crates \"@crates//:serde\", \"@crates//:serde_json\", \"@crates//:tokio\", ], visibility = [\"//visibility:public\"],\n) Notice, direct dependencies do not need repining. Only a cargo workspace needs updating whenever the underlying Cargo.toml file changed.","breadcrumbs":"External Crates » crate_universe (bzlmod) » Direct Dependencies","id":"146","title":"Direct Dependencies"},"147":{"body":"In some cases, it is require that all external dependencies are vendored, meaning downloaded and stored in the workspace. This helps, for example, to conduct licence scans, apply custom patches, or to ensure full build reproducibility since no download error could possibly occur. You find a complete example in the in the example folder . For the setup, you need to add the skylib in addition to the rust rules to your MODUE.bazel. module( name = \"deps_vendored\", version = \"0.0.0\"\n)\n###############################################################################\n# B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/\n###############################################################################\n# https://github.com/bazelbuild/bazel-skylib/releases/\nbazel_dep(name = \"bazel_skylib\", version = \"1.7.1\") # https://github.com/bazelbuild/rules_rust/releases\nbazel_dep(name = \"rules_rust\", version = \"0.49.3\") ###############################################################################\n# T O O L C H A I N S\n############################################################################### # Rust toolchain\nRUST_EDITION = \"2021\"\nRUST_VERSION = \"1.80.1\" rust = use_extension(\"@rules_rust//rust:extensions.bzl\", \"rust\")\nrust.toolchain( edition = RUST_EDITION, versions = [RUST_VERSION],\n)\nuse_repo(rust, \"rust_toolchains\")\nregister_toolchains(\"@rust_toolchains//:all\") ###############################################################################\n# R U S T C R A T E S\n###############################################################################\ncrate = use_extension(\"@rules_rust//crate_universe:extension.bzl\", \"crate\") Note, it is important to load the crate_universe rules otherwise you will get an error as the rule set is needed in the vendored target. Assuming you have a package called basic in which you want to vendor dependencies, then you create a folder basic/3rdparty. The folder name can be arbitrary, but by convention, its either thirdparty or 3rdparty to indicate vendored dependencies. In the 3rdparty folder, you add a target crates_vendor to declare your dependencies to vendor. In the example, we vendor a specific version of bzip2. load(\"@rules_rust//crate_universe:defs.bzl\", \"crate\", \"crates_vendor\") crates_vendor( name = \"crates_vendor\", annotations = { \"bzip2-sys\": [crate.annotation( gen_build_script = True, )], }, cargo_lockfile = \"Cargo.Bazel.lock\", generate_build_scripts = False, mode = \"remote\", packages = { \"bzip2\": crate.spec( version = \"=0.3.3\", ), }, repository_name = \"basic\", tags = [\"manual\"],\n) Next, you have to run Cargo build to generate a Cargo.lock file with all resolved dependencies. Then, you rename Cargo.lock to Cargo.Bazel.lock and place it inside the basic/3rdparty folder. At this point, you have the following folder and files: basic ├── 3rdparty │ ├── BUILD.bazel │ ├── Cargo.Bazel.lock Now you can run the crates_vendor target: bazel run //basic/3rdparty:crates_vendor This generates a crate folders with all configurations for the vendored dependencies. basic ├── 3rdparty │ ├── cratea │ ├── BUILD.bazel │ ├── Cargo.Bazel.lock Suppose you have an application in basic/src that is defined in basic/BUILD.bazel and that depends on a vendored dependency. You find a list of all available vendored dependencies in the BUILD file of the generated folder: basic/3rdparty/crates/BUILD.bazel You declare a vendored dependency in you target as following: load(\"@rules_rust//rust:defs.bzl\", \"rust_binary\") rust_binary( name = \"hello_sys\", srcs = [\"src/main.rs\"], deps = [\"//basic/3rdparty/crates:bzip2\"], visibility = [\"//visibility:public\"],\n) Note, the vendored dependency is not yet accessible because you have to define first how to load the vendored dependencies. For that, you first create a file sys_deps.bzl and add the following content: # rename the default name \"crate_repositories\" in case you import multiple vendored folders.\nload(\"//basic/3rdparty/crates:defs.bzl\", basic_crate_repositories = \"crate_repositories\") def sys_deps(): # Load the vendored dependencies basic_crate_repositories() This is straightforward, you import the generated crate_repositories from the crates folder, rename it to avoid name clashes in case you import from multiple vendored folders, and then just load the vendored dependencies. In a WORKSPACE configuration, you would just load and call sys_deps(), but in a MODULE configuration, you cannot do that. Instead, you create a new file WORKSPACE.bzlmod and add the following content. load(\"//:sys_deps.bzl\", \"sys_deps\")\nsys_deps() Now, you can build the project as usual. There are some more examples of using crate_universe with bzlmod in the example folder .","breadcrumbs":"External Crates » crate_universe (bzlmod) » Vendored Dependencies","id":"147","title":"Vendored Dependencies"},"148":{"body":"crate = use_extension(\"@rules_rust//crate_universe:docs_bzlmod.bzl\", \"crate\")\ncrate.from_cargo(name, cargo_config, cargo_lockfile, generate_binaries, generate_build_scripts, manifests, splicing_config, supported_platform_triples)\ncrate.annotation(deps, data, additive_build_file, additive_build_file_content, alias_rule, build_script_data, build_script_data_glob, build_script_deps, build_script_env, build_script_proc_macro_deps, build_script_rundir, build_script_rustc_env, build_script_toolchains, build_script_tools, compile_data, compile_data_glob, crate, crate_features, data_glob, disable_pipelining, extra_aliased_targets, gen_all_binaries, gen_binaries, gen_build_script, override_target_bin, override_target_build_script, override_target_lib, override_target_proc_macro, patch_args, patch_tool, patches, proc_macro_deps, repositories, rustc_env, rustc_env_files, rustc_flags, shallow_since, version)\ncrate.from_specs(name, cargo_config, generate_binaries, generate_build_scripts, splicing_config, supported_platform_triples)\ncrate.spec(artifact, branch, default_features, features, git, lib, package, rev, tag, version) TAG CLASSES","breadcrumbs":"External Crates » crate_universe (bzlmod) » crate","id":"148","title":"crate"},"149":{"body":"Generates a repo @crates from a Cargo.toml / Cargo.lock pair Attributes Name Description Type Mandatory Default name The name of the repo to generate Name optional \"crates\" cargo_config A Cargo configuration file. Label optional None cargo_lockfile The path to an existing Cargo.lock file Label optional None generate_binaries Whether to generate rust_binary targets for all the binary crates in every package. By default only the rust_library targets are generated. Boolean optional False generate_build_scripts Whether or not to generate cargo build scripts by default. Boolean optional True manifests A list of Cargo manifests (Cargo.toml files). List of labels optional [] splicing_config The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. String optional \"\" supported_platform_triples A set of all platform triples to consider when generating dependencies. List of strings optional [\"aarch64-apple-darwin\", \"aarch64-apple-ios\", \"aarch64-apple-ios-sim\", \"aarch64-linux-android\", \"aarch64-pc-windows-msvc\", \"aarch64-unknown-fuchsia\", \"aarch64-unknown-linux-gnu\", \"aarch64-unknown-nixos-gnu\", \"aarch64-unknown-nto-qnx710\", \"arm-unknown-linux-gnueabi\", \"armv7-linux-androideabi\", \"armv7-unknown-linux-gnueabi\", \"i686-apple-darwin\", \"i686-linux-android\", \"i686-pc-windows-msvc\", \"i686-unknown-freebsd\", \"i686-unknown-linux-gnu\", \"powerpc-unknown-linux-gnu\", \"riscv32imc-unknown-none-elf\", \"riscv64gc-unknown-none-elf\", \"s390x-unknown-linux-gnu\", \"thumbv7em-none-eabi\", \"thumbv8m.main-none-eabi\", \"wasm32-unknown-unknown\", \"wasm32-wasi\", \"wasm32-wasip1\", \"x86_64-apple-darwin\", \"x86_64-apple-ios\", \"x86_64-linux-android\", \"x86_64-pc-windows-msvc\", \"x86_64-unknown-freebsd\", \"x86_64-unknown-fuchsia\", \"x86_64-unknown-linux-gnu\", \"x86_64-unknown-nixos-gnu\", \"x86_64-unknown-none\"]","breadcrumbs":"External Crates » crate_universe (bzlmod) » from_cargo","id":"149","title":"from_cargo"},"15":{"body":"extra_rustc_flags(name) Add additional rustc_flags from the command line with --@rules_rust//:extra_rustc_flags. This flag should only be used for flags that need to be applied across the entire build. For options that apply to individual crates, use the rustc_flags attribute on the individual crate's rule instead. NOTE: These flags not applied to the exec configuration (proc-macros, cargo_build_script, etc); use --@rules_rust//:extra_exec_rustc_flags to apply flags to the exec configuration. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required","breadcrumbs":"Rules » rust » extra_rustc_flags","id":"15","title":"extra_rustc_flags"},"150":{"body":"Attributes Name Description Type Mandatory Default deps A list of labels to add to a crate's rust_library::deps attribute. List of strings optional [] data A list of labels to add to a crate's rust_library::data attribute. List of strings optional [] additive_build_file A file containing extra contents to write to the bottom of generated BUILD files. Label optional None additive_build_file_content Extra contents to write to the bottom of generated BUILD files. String optional \"\" alias_rule Alias rule to use instead of native.alias(). Overrides render_config 's 'default_alias_rule'. String optional \"\" build_script_data A list of labels to add to a crate's cargo_build_script::data attribute. List of strings optional [] build_script_data_glob A list of glob patterns to add to a crate's cargo_build_script::data attribute List of strings optional [] build_script_deps A list of labels to add to a crate's cargo_build_script::deps attribute. List of strings optional [] build_script_env Additional environment variables to set on a crate's cargo_build_script::env attribute. Dictionary: String -> String optional {} build_script_proc_macro_deps A list of labels to add to a crate's cargo_build_script::proc_macro_deps attribute. List of strings optional [] build_script_rundir An override for the build script's rundir attribute. String optional \"\" build_script_rustc_env Additional environment variables to set on a crate's cargo_build_script::env attribute. Dictionary: String -> String optional {} build_script_toolchains A list of labels to set on a crates's cargo_build_script::toolchains attribute. List of labels optional [] build_script_tools A list of labels to add to a crate's cargo_build_script::tools attribute. List of strings optional [] compile_data A list of labels to add to a crate's rust_library::compile_data attribute. List of strings optional [] compile_data_glob A list of glob patterns to add to a crate's rust_library::compile_data attribute. List of strings optional [] crate The name of the crate the annotation is applied to String required crate_features A list of strings to add to a crate's rust_library::crate_features attribute. List of strings optional [] data_glob A list of glob patterns to add to a crate's rust_library::data attribute. List of strings optional [] disable_pipelining If True, disables pipelining for library targets for this crate. Boolean optional False extra_aliased_targets A list of targets to add to the generated aliases in the root crate_universe repository. Dictionary: String -> String optional {} gen_all_binaries If true, generates rust_binary targets for all of the crates bins Boolean optional False gen_binaries As a list, the subset of the crate's bins that should get rust_binary targets produced. List of strings optional [] gen_build_script An authorative flag to determine whether or not to produce cargo_build_script targets for the current crate. Supported values are 'on', 'off', and 'auto'. String optional \"auto\" override_target_bin An optional alternate taget to use when something depends on this crate to allow the parent repo to provide its own version of this dependency. Label optional None override_target_build_script An optional alternate taget to use when something depends on this crate to allow the parent repo to provide its own version of this dependency. Label optional None override_target_lib An optional alternate taget to use when something depends on this crate to allow the parent repo to provide its own version of this dependency. Label optional None override_target_proc_macro An optional alternate taget to use when something depends on this crate to allow the parent repo to provide its own version of this dependency. Label optional None patch_args The patch_args attribute of a Bazel repository rule. See http_archive.patch_args List of strings optional [] patch_tool The patch_tool attribute of a Bazel repository rule. See http_archive.patch_tool String optional \"\" patches The patches attribute of a Bazel repository rule. See http_archive.patches List of labels optional [] proc_macro_deps A list of labels to add to a crate's rust_library::proc_macro_deps attribute. List of strings optional [] repositories A list of repository names specified from crate.from_cargo(name=...) that this annotation is applied to. Defaults to all repositories. List of strings optional [] rustc_env Additional variables to set on a crate's rust_library::rustc_env attribute. Dictionary: String -> String optional {} rustc_env_files A list of labels to set on a crate's rust_library::rustc_env_files attribute. List of strings optional [] rustc_flags A list of strings to set on a crate's rust_library::rustc_flags attribute. List of strings optional [] shallow_since An optional timestamp used for crates originating from a git repository instead of a crate registry. This flag optimizes fetching the source code. String optional \"\" version The versions of the crate the annotation is applied to. Defaults to all versions. String optional \"*\"","breadcrumbs":"External Crates » crate_universe (bzlmod) » annotation","id":"150","title":"annotation"},"151":{"body":"Generates a repo @crates from the defined spec tags Attributes Name Description Type Mandatory Default name The name of the repo to generate Name optional \"crates\" cargo_config A Cargo configuration file. Label optional None generate_binaries Whether to generate rust_binary targets for all the binary crates in every package. By default only the rust_library targets are generated. Boolean optional False generate_build_scripts Whether or not to generate cargo build scripts by default. Boolean optional True splicing_config The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. String optional \"\" supported_platform_triples A set of all platform triples to consider when generating dependencies. List of strings optional [\"aarch64-apple-darwin\", \"aarch64-apple-ios\", \"aarch64-apple-ios-sim\", \"aarch64-linux-android\", \"aarch64-pc-windows-msvc\", \"aarch64-unknown-fuchsia\", \"aarch64-unknown-linux-gnu\", \"aarch64-unknown-nixos-gnu\", \"aarch64-unknown-nto-qnx710\", \"arm-unknown-linux-gnueabi\", \"armv7-linux-androideabi\", \"armv7-unknown-linux-gnueabi\", \"i686-apple-darwin\", \"i686-linux-android\", \"i686-pc-windows-msvc\", \"i686-unknown-freebsd\", \"i686-unknown-linux-gnu\", \"powerpc-unknown-linux-gnu\", \"riscv32imc-unknown-none-elf\", \"riscv64gc-unknown-none-elf\", \"s390x-unknown-linux-gnu\", \"thumbv7em-none-eabi\", \"thumbv8m.main-none-eabi\", \"wasm32-unknown-unknown\", \"wasm32-wasi\", \"wasm32-wasip1\", \"x86_64-apple-darwin\", \"x86_64-apple-ios\", \"x86_64-linux-android\", \"x86_64-pc-windows-msvc\", \"x86_64-unknown-freebsd\", \"x86_64-unknown-fuchsia\", \"x86_64-unknown-linux-gnu\", \"x86_64-unknown-nixos-gnu\", \"x86_64-unknown-none\"]","breadcrumbs":"External Crates » crate_universe (bzlmod) » from_specs","id":"151","title":"from_specs"},"152":{"body":"Attributes Name Description Type Mandatory Default artifact Set to 'bin' to pull in a binary crate as an artifact dependency. Requires a nightly Cargo. String optional \"\" branch The git branch of the remote crate. Tied with the git param. Only one of branch, tag or rev may be specified. Specifying rev is recommended for fully-reproducible builds. String optional \"\" default_features Maps to the default-features flag. Boolean optional True features A list of features to use for the crate. List of strings optional [] git The Git url to use for the crate. Cannot be used with version. String optional \"\" lib If using artifact = 'bin', additionally setting lib = True declares a dependency on both the package's library and binary, as opposed to just the binary. Boolean optional False package The explicit name of the package. String required rev The git revision of the remote crate. Tied with the git param. Only one of branch, tag or rev may be specified. String optional \"\" tag The git tag of the remote crate. Tied with the git param. Only one of branch, tag or rev may be specified. Specifying rev is recommended for fully-reproducible builds. String optional \"\" version The exact version of the crate. Cannot be used with git. String optional \"\"","breadcrumbs":"External Crates » crate_universe (bzlmod) » spec","id":"152","title":"spec"},"153":{"body":"Crate Universe is a set of Bazel rule for generating Rust targets using Cargo. This doc describes using crate_universe from a WORKSPACE file. If you're using bzlmod, please see the bzlmod equivalent of this doc .","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Crate Universe","id":"153","title":"Crate Universe"},"154":{"body":"After loading rules_rust in your workspace, set the following to begin using crate_universe: load(\"@rules_rust//crate_universe:repositories.bzl\", \"crate_universe_dependencies\") crate_universe_dependencies() Note that if the current version of rules_rust is not a release artifact, you may need to set additional flags such as bootstrap = True on the crate_universe_dependencies call above or crates_repository::generator_urls in uses of crates_repository.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Setup","id":"154","title":"Setup"},"155":{"body":"crates_repository crates_vendor","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Rules","id":"155","title":"Rules"},"156":{"body":"crate_universe_dependencies crate.annotation crate.select crate.spec crate.workspace_member render_config splicing_config","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Utility Macros","id":"156","title":"Utility Macros"},"157":{"body":"The crates_repository rule (the primary repository rule of rules_rust's cargo support) supports a number of different ways users can express and organize their dependencies. The most common are listed below though there are more to be found in the ./examples/crate_universe directory.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Workflows","id":"157","title":"Workflows"},"158":{"body":"One of the simpler ways to wire up dependencies would be to first structure your project into a Cargo workspace . The crates_repository rule can ingest a root Cargo.toml file and generate dependencies from there. load(\"@rules_rust//crate_universe:defs.bzl\", \"crates_repository\") crates_repository( name = \"crate_index\", cargo_lockfile = \"//:Cargo.lock\", lockfile = \"//:Cargo.Bazel.lock\", manifests = [\"//:Cargo.toml\"],\n) load(\"@crate_index//:defs.bzl\", \"crate_repositories\") crate_repositories() The generated crates_repository contains helper macros which make collecting dependencies for Bazel targets simpler. Notably, the all_crate_deps and aliases macros (see Dependencies API ) commonly allow the Cargo.toml files to be the single source of truth for dependencies. Since these macros come from the generated repository, the dependencies and alias definitions they return will automatically update BUILD targets. load(\"@crate_index//:defs.bzl\", \"aliases\", \"all_crate_deps\")\nload(\"@rules_rust//rust:defs.bzl\", \"rust_library\", \"rust_test\") rust_library( name = \"lib\", aliases = aliases(), deps = all_crate_deps( normal = True, ), proc_macro_deps = all_crate_deps( proc_macro = True, ),\n) rust_test( name = \"unit_test\", crate = \":lib\", aliases = aliases( normal_dev = True, proc_macro_dev = True, ), deps = all_crate_deps( normal_dev = True, ), proc_macro_deps = all_crate_deps( proc_macro_dev = True, ),\n)","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Cargo Workspaces","id":"158","title":"Cargo Workspaces"},"159":{"body":"In cases where Rust targets have heavy interractions with other Bazel targests ( Cc , Proto , etc.), maintaining Cargo.toml files may have deminishing returns as things like rust-analyzer begin to be confused about missing targets or environment variables defined only in Bazel. In workspaces like this, it may be desirable to have a \"Cargo free\" setup. crates_repository supports this through the packages attribute. load(\"@rules_rust//crate_universe:defs.bzl\", \"crate\", \"crates_repository\", \"render_config\") crates_repository( name = \"crate_index\", cargo_lockfile = \"//:Cargo.lock\", lockfile = \"//:Cargo.Bazel.lock\", packages = { \"async-trait\": crate.spec( version = \"0.1.51\", ), \"mockall\": crate.spec( version = \"0.10.2\", ), \"tokio\": crate.spec( version = \"1.12.0\", ), }, # Setting the default package name to `\"\"` forces the use of the macros defined in this repository # to always use the root package when looking for dependencies or aliases. This should be considered # optional as the repository also exposes alises for easy access to all dependencies. render_config = render_config( default_package_name = \"\" ),\n) load(\"@crate_index//:defs.bzl\", \"crate_repositories\") crate_repositories() Consuming dependencies may be more ergonomic in this case through the aliases defined in the new repository. load(\"@rules_rust//rust:defs.bzl\", \"rust_library\", \"rust_test\") rust_library( name = \"lib\", deps = [ \"@crate_index//:tokio\", ], proc_macro_deps = [ \"@crate_index//:async-trait\", ],\n) rust_test( name = \"unit_test\", crate = \":lib\", deps = [ \"@crate_index//:mockall\", ],\n)","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Direct Packages","id":"159","title":"Direct Packages"},"16":{"body":"rust_binary(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name, crate_root, crate_type, edition, env, experimental_use_cc_common_link, linker_script, malloc, out_binary, platform, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, stamp, version) Builds a Rust binary crate. Example: Suppose you have the following directory structure for a Rust project with a library crate, hello_lib, and a binary crate, hello_world that uses the hello_lib library: [workspace]/ WORKSPACE hello_lib/ BUILD src/ lib.rs hello_world/ BUILD src/ main.rs hello_lib/src/lib.rs: pub struct Greeter { greeting: String,\n} impl Greeter { pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } pub fn greet(&self, thing: &str) { println!(\"{} {}\", &self.greeting, thing); }\n} hello_lib/BUILD: package(default_visibility = [\"//visibility:public\"]) load(\"@rules_rust//rust:defs.bzl\", \"rust_library\") rust_library( name = \"hello_lib\", srcs = [\"src/lib.rs\"],\n) hello_world/src/main.rs: extern crate hello_lib; fn main() { let hello = hello_lib::Greeter::new(\"Hello\"); hello.greet(\"world\");\n} hello_world/BUILD: load(\"@rules_rust//rust:defs.bzl\", \"rust_binary\") rust_binary( name = \"hello_world\", srcs = [\"src/main.rs\"], deps = [\"//hello_lib\"],\n) Build and run hello_world: $ bazel run //hello_world\nINFO: Found 1 target...\nTarget //examples/rust/hello_world:hello_world up-to-date:\nbazel-bin/examples/rust/hello_world/hello_world\nINFO: Elapsed time: 1.308s, Critical Path: 1.22s INFO: Running command line: bazel-bin/examples/rust/hello_world/hello_world\nHello world On Windows, a PDB file containing debugging information is available under the key pdb_file in OutputGroupInfo. Similarly on macOS, a dSYM folder is available under the key dsym_folder in OutputGroupInfo. ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required deps List of other libraries to be linked to this library target.These can be either other rust_library targets or cc_library targets if linking a native library. List of labels optional [] srcs List of Rust .rs source files used to build the library.If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. List of labels optional [] data List of files used by this rule at compile time and runtime.If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. List of labels optional [] aliases Remap crates to a new name or moniker for linkage to this targetThese are other rust_library targets and will be presented as the new name given. Dictionary: Label -> String optional {} alwayslink If 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.This attribute is used by the C++ Starlark API when passing CcInfo providers. Boolean optional False compile_data List of files used by this rule at compile time.This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro. List of labels optional [] crate_features List of features to enable for this crate.Features are defined in the code using the #[cfg(feature = \"foo\")] configuration option. The features listed here will be passed to rustc with --cfg feature=\"${feature_name}\" flags. List of strings optional [] crate_name Crate name to use for this target.This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. String optional \"\" crate_root The file that will be passed to rustc to be used for building this crate.If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. Label optional None crate_type Crate type that will be passed to rustc to be used for building this crate.This option is a temporary workaround and should be used only when building for WebAssembly targets (//rust/platform:wasi and //rust/platform:wasm). String optional \"bin\" edition The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. String optional \"\" env Specifies additional environment variables to set when the target is executed by bazel run. Values are subject to $(rootpath), $(execpath), location, and \"Make variable\" substitution.Execpath returns absolute path, and in order to be able to construct the absolute path we need to wrap the test binary in a launcher. Using a launcher comes with complications, such as more complicated debugger attachment. Dictionary: String -> String optional {} experimental_use_cc_common_link Whether to use cc_common.link to link rust binaries. Possible values: [-1, 0, 1]. -1 means use the value of the toolchain.experimental_use_cc_common_link boolean build setting to determine. 0 means do not use cc_common.link (use rustc instead). 1 means use cc_common.link. Integer optional -1 linker_script Link script to forward into linker via rustc options. Label optional None malloc Override the default dependency on malloc.By default, Rust binaries linked with cc_common.link are linked against @bazel_tools//tools/cpp:malloc\", which is an empty library and the resulting binary will use libc's malloc. This label must refer to a cc_library rule. Label optional \"@bazel_tools//tools/cpp:malloc\" out_binary Force a target, regardless of it's crate_type, to always mark the file as executable. This attribute is only used to support wasm targets but is expected to be removed following a resolution to https://github.com/bazelbuild/rules_rust/issues/771. Boolean optional False platform Optional platform to transition the binary to. Label optional None proc_macro_deps List of rust_proc_macro targets used to help build this library target. List of labels optional [] rustc_env Dictionary of additional \"key\": \"value\" environment variables to set for rustc.rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. Dictionary: String -> String optional {} rustc_env_files Files containing additional environment variables to set for rustc.These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\\\).The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.Note that the variables here are subject to workspace status stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. List of labels optional [] rustc_flags List of compiler flags passed to rustc.These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). List of strings optional [] stamp Whether to encode build information into the Rustc action. Possible values:- stamp = 1: Always stamp the build information into the Rustc action, even in --nostamp builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.- stamp = 0: Always replace build information by constant values. This gives good build result caching.- stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.Stamped targets are not rebuilt unless their dependencies change.For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how cc_library.linkstamps behaves. Integer optional -1 version A version to inject in the cargo environment variable. String optional \"0.0.0\"","breadcrumbs":"Rules » rust » rust_binary","id":"16","title":"rust_binary"},"160":{"body":"Neither of the above approaches supports depending on binary-only packages. In order to depend on a Cargo package that contains binaries and no library, you will need to do one of the following: Fork the package to add an empty lib.rs, which makes the package visible to Cargo metadata and compatible with the above approaches; Or handwrite your own build target for the binary, use http_archive to import its source code, and use crates_repository to make build targets for its dependencies. This is demonstrated below using the rustfilt crate as an example. # in WORKSPACE.bazel load(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\") http_archive( name = \"rustfilt\", build_file = \"//rustfilt:BUILD.rustfilt.bazel\", sha256 = \"c8d748b182c8f95224336d20dcc5609598af612581ce60cfb29da4dc8d0091f2\", strip_prefix = \"rustfilt-0.2.1\", type = \"tar.gz\", urls = [\"https://static.crates.io/crates/rustfilt/rustfilt-0.2.1.crate\"],\n) load(\"@rules_rust//crate_universe:defs.bzl\", \"crates_repository\") crates_repository( name = \"rustfilt_deps\", cargo_lockfile = \"//rustfilt:Cargo.lock\", manifests = [\"@rustfilt//:Cargo.toml\"],\n) load(\"@rustfilt_deps//:defs.bzl\", rustfilt_deps = \"crate_repositories\") rustfilt_deps() # in rustfilt/BUILD.rustfilt.bazel load(\"@rules_rust//rust:defs.bzl\", \"rust_binary\") rust_binary( name = \"rustfilt\", srcs = glob([\"src/**/*.rs\"]), edition = \"2018\", deps = [ \"@rustfilt_deps//:clap\", \"@rustfilt_deps//:lazy_static\", \"@rustfilt_deps//:regex\", \"@rustfilt_deps//:rustc-demangle\", ],\n) If you use either crates_repository or crates_vendor to depend on a Cargo package that contains both a library crate and binaries, by default only the library gets made available to Bazel. To generate Bazel targets for the binary crates as well, you must opt in to it with an annotation on the package: load(\"@rules_rust//crate_universe:defs.bzl\", \"crates_repository\", \"crate\") crates_repository( name = \"crate_index\", annotations = { \"thepackage\": [crate.annotation( gen_binaries = True, # Or, to expose just a subset of the package's binaries by name: gen_binaries = [\"rustfilt\"], )], }, # Or, to expose every binary of every package: generate_binaries = True, ...\n)","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Binary dependencies","id":"160","title":"Binary dependencies"},"161":{"body":"After rendering dependencies, convenience macros may also be generated to provide convenient accessors to larger sections of the dependency graph. aliases crate_deps all_crate_deps crate_repositories","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Dependencies API","id":"161","title":"Dependencies API"},"162":{"body":"Some crates have build.rs scripts which are complicated to run. Typically these build C++ (or other languages), or attempt to find pre-installed libraries on the build machine. There are a few approaches to making sure these run:","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Building crates with complicated dependencies","id":"162","title":"Building crates with complicated dependencies"},"163":{"body":"Some build scripts will happily run without any support needed. rules_rust already supplies a configured C++ toolchain as input to build script execution, and sets variables like CC, CXX, LD, LDFLAGS, etc as needed. Many crates which invoke a compiler with the default environment, or forward these env vars, will Just Work (e.g. if using cc-rs ). rules_rust is open to PRs which make build scripts more likely to work by default with intervention assuming they're broadly applicable (e.g. setting extra widely-known env vars is probably fine, wiring up additional toolchains like cmake that aren't present by default for most Bazel users probably isn't).","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Some things work without intervention","id":"163","title":"Some things work without intervention"},"164":{"body":"Some build scripts can be made to work by pulling in some extra files and making them available to the build script. Commonly this is done by passing the file to the build_script_data annotation for the crate, and using build_script_env to tell the build script where the file is. That env var may often use $(execroot) to get the path to the label, or $${pwd}/ as a prefix if the path given is relative to the execroot (as will frequently happen when using a toolchain).A There is an example of this in the \"complicated dependencies\" section of https://github.com/bazelbuild/rules_rust/blob/main/examples/crate_universe/WORKSPACE.bazel which builds libz-ng-sys.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Supplying extra tools to build","id":"164","title":"Supplying extra tools to build"},"165":{"body":"Some build scripts have hooks to allow replacing parts that are complicated to build with output prepared by Bazel. We can use those hooks by specifying paths (generally using the build_script_data and build_script_env annotations) and pointing them at labels which Bazel will then build. These env vars may often use $(execroot) to get the path to the label, or $${pwd}/ as a prefix if the path given is relative to the execroot (as will frequently happen when using a toolchain). There is an example of this in the \"complicated dependencies\" section of https://github.com/bazelbuild/rules_rust/blob/main/examples/crate_universe/WORKSPACE.bazel which builds boring-sys.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Building with Bazel and supplying via an override","id":"165","title":"Building with Bazel and supplying via an override"},"166":{"body":"crates_vendor(name, annotations, bazel, buildifier, cargo_bazel, cargo_config, cargo_lockfile, generate_binaries, generate_build_scripts, generate_target_compatible_with, manifests, mode, packages, render_config, repository_name, splicing_config, supported_platform_triples, vendor_path) A rule for defining Rust dependencies (crates) and writing targets for them to the current workspace. This rule is useful for users whose workspaces are expected to be consumed in other workspaces as the rendered BUILD files reduce the number of workspace dependencies, allowing for easier loads. This rule handles all the same workflows crate_universe rules do. Example: Given the following workspace structure: [workspace]/ WORKSPACE BUILD Cargo.toml 3rdparty/ BUILD src/ main.rs The following is something that'd be found in 3rdparty/BUILD: load(\"@rules_rust//crate_universe:defs.bzl\", \"crates_vendor\", \"crate\") crates_vendor( name = \"crates_vendor\", annotations = { \"rand\": [crate.annotation( default_features = False, features = [\"small_rng\"], )], }, cargo_lockfile = \"//:Cargo.Bazel.lock\", manifests = [\"//:Cargo.toml\"], mode = \"remote\", vendor_path = \"crates\", tags = [\"manual\"],\n) The above creates a target that can be run to write BUILD files into the 3rdparty directory next to where the target is defined. To run it, simply call: bazel run //3rdparty:crates_vendor","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crates_vendor","id":"166","title":"crates_vendor"},"167":{"body":"Repinning dependencies is controlled by both the CARGO_BAZEL_REPIN environment variable or the --repin flag to the crates_vendor binary. To update dependencies, simply add the flag ro your bazel run invocation. bazel run //3rdparty:crates_vendor -- --repin Under the hood, --repin will trigger a cargo update call against the generated workspace. The following table describes how to control particular values passed to the cargo update command. Value Cargo command Any of [true, 1, yes, on, workspace] cargo update --workspace Any of [full, eager, all] cargo update package_name cargo upgrade --package package_name package_name@1.2.3 cargo upgrade --package package_name --precise 1.2.3 ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required annotations Extra settings to apply to crates. See crate.annotation . Dictionary: String -> List of strings optional {} bazel The path to a bazel binary used to locate the output_base for the current workspace. Label optional None buildifier The path to a buildifier binary used to format generated BUILD files. Label optional \"@rules_rust//crate_universe/private/vendor:buildifier\" cargo_bazel The cargo-bazel binary to use for vendoring. If this attribute is not set, then a CARGO_BAZEL_GENERATOR_PATH action env will be used. Label optional \"@@cargo_bazel_bootstrap//:binary\" cargo_config A Cargo configuration file. Label optional None cargo_lockfile The path to an existing Cargo.lock file Label optional None generate_binaries Whether to generate rust_binary targets for all the binary crates in every package. By default only the rust_library targets are generated. Boolean optional False generate_build_scripts Whether or not to generate cargo build scripts by default. Boolean optional True generate_target_compatible_with DEPRECATED: Moved to render_config. Boolean optional True manifests A list of Cargo manifests (Cargo.toml files). List of labels optional [] mode Flags determining how crates should be vendored. local is where crate source and BUILD files are written to the repository. remote is where only BUILD files are written and repository rules used to fetch source code. String optional \"remote\" packages A set of crates (packages) specifications to depend on. See crate.spec . Dictionary: String -> String optional {} render_config The configuration flags to use for rendering. Use //crate_universe:defs.bzl\\%render_config to generate the value for this field. If unset, the defaults defined there will be used. String optional \"\" repository_name The name of the repository to generate for remote vendor modes. If unset, the label name will be used String optional \"\" splicing_config The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. String optional \"\" supported_platform_triples A set of all platform triples to consider when generating dependencies. List of strings optional [\"aarch64-apple-darwin\", \"aarch64-apple-ios\", \"aarch64-apple-ios-sim\", \"aarch64-linux-android\", \"aarch64-pc-windows-msvc\", \"aarch64-unknown-fuchsia\", \"aarch64-unknown-linux-gnu\", \"aarch64-unknown-nixos-gnu\", \"aarch64-unknown-nto-qnx710\", \"arm-unknown-linux-gnueabi\", \"armv7-linux-androideabi\", \"armv7-unknown-linux-gnueabi\", \"i686-apple-darwin\", \"i686-linux-android\", \"i686-pc-windows-msvc\", \"i686-unknown-freebsd\", \"i686-unknown-linux-gnu\", \"powerpc-unknown-linux-gnu\", \"riscv32imc-unknown-none-elf\", \"riscv64gc-unknown-none-elf\", \"s390x-unknown-linux-gnu\", \"thumbv7em-none-eabi\", \"thumbv8m.main-none-eabi\", \"wasm32-unknown-unknown\", \"wasm32-wasi\", \"wasm32-wasip1\", \"x86_64-apple-darwin\", \"x86_64-apple-ios\", \"x86_64-linux-android\", \"x86_64-pc-windows-msvc\", \"x86_64-unknown-freebsd\", \"x86_64-unknown-fuchsia\", \"x86_64-unknown-linux-gnu\", \"x86_64-unknown-nixos-gnu\", \"x86_64-unknown-none\"] vendor_path The path to a directory to write files into. Absolute paths will be treated as relative to the workspace root String optional \"crates\"","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » Repinning / Updating Dependencies","id":"167","title":"Repinning / Updating Dependencies"},"168":{"body":"aliases(normal, normal_dev, proc_macro, proc_macro_dev, build, build_proc_macro, package_name) Produces a map of Crate alias names to their original label If no dependency kinds are specified, normal and proc_macro are used by default. Setting any one flag will otherwise determine the contents of the returned dict. PARAMETERS Name Description Default Value normal If True, normal dependencies are included in the output list. False normal_dev If True, normal dev dependencies will be included in the output list.. False proc_macro If True, proc_macro dependencies are included in the output list. False proc_macro_dev If True, dev proc_macro dependencies are included in the output list. False build If True, build dependencies are included in the output list. False build_proc_macro If True, build proc_macro dependencies are included in the output list. False package_name The package name of the set of dependencies to look up. Defaults to native.package_name() when unset. None RETURNS dict: The aliases of all associated packages","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » aliases","id":"168","title":"aliases"},"169":{"body":"all_crate_deps(normal, normal_dev, proc_macro, proc_macro_dev, build, build_proc_macro, package_name) Finds the fully qualified label of all requested direct crate dependencies for the package where this macro is called. If no parameters are set, all normal dependencies are returned. Setting any one flag will otherwise impact the contents of the returned list. PARAMETERS Name Description Default Value normal If True, normal dependencies are included in the output list. False normal_dev If True, normal dev dependencies will be included in the output list.. False proc_macro If True, proc_macro dependencies are included in the output list. False proc_macro_dev If True, dev proc_macro dependencies are included in the output list. False build If True, build dependencies are included in the output list. False build_proc_macro If True, build proc_macro dependencies are included in the output list. False package_name The package name of the set of dependencies to look up. Defaults to native.package_name() when unset. None RETURNS list: A list of labels to generated rust targets (str)","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » all_crate_deps","id":"169","title":"all_crate_deps"},"17":{"body":"rust_library(name, deps, srcs, data, aliases, alwayslink, compile_data, crate_features, crate_name, crate_root, disable_pipelining, edition, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, stamp, version) Builds a Rust library crate. Example: Suppose you have the following directory structure for a simple Rust library crate: [workspace]/ WORKSPACE hello_lib/ BUILD src/ greeter.rs lib.rs hello_lib/src/greeter.rs: pub struct Greeter { greeting: String,\n} impl Greeter { pub fn new(greeting: &str) -> Greeter { Greeter { greeting: greeting.to_string(), } } pub fn greet(&self, thing: &str) { println!(\"{} {}\", &self.greeting, thing); }\n} hello_lib/src/lib.rs: pub mod greeter; hello_lib/BUILD: package(default_visibility = [\"//visibility:public\"]) load(\"@rules_rust//rust:defs.bzl\", \"rust_library\") rust_library( name = \"hello_lib\", srcs = [ \"src/greeter.rs\", \"src/lib.rs\", ],\n) Build the library: $ bazel build //hello_lib\nINFO: Found 1 target...\nTarget //examples/rust/hello_lib:hello_lib up-to-date:\nbazel-bin/examples/rust/hello_lib/libhello_lib.rlib\nINFO: Elapsed time: 1.245s, Critical Path: 1.01s ATTRIBUTES Name Description Type Mandatory Default name A unique name for this target. Name required deps List of other libraries to be linked to this library target.These can be either other rust_library targets or cc_library targets if linking a native library. List of labels optional [] srcs List of Rust .rs source files used to build the library.If srcs contains more than one file, then there must be a file either named lib.rs. Otherwise, crate_root must be set to the source file that is the root of the crate to be passed to rustc to build this crate. List of labels optional [] data List of files used by this rule at compile time and runtime.If including data at compile time with include_str!() and similar, prefer compile_data over data, to prevent the data also being included in the runfiles. List of labels optional [] aliases Remap crates to a new name or moniker for linkage to this targetThese are other rust_library targets and will be presented as the new name given. Dictionary: Label -> String optional {} alwayslink If 1, any binary that depends (directly or indirectly) on this library will link in all the object files even if some contain no symbols referenced by the binary.This attribute is used by the C++ Starlark API when passing CcInfo providers. Boolean optional False compile_data List of files used by this rule at compile time.This attribute can be used to specify any data files that are embedded into the library, such as via the include_str! macro. List of labels optional [] crate_features List of features to enable for this crate.Features are defined in the code using the #[cfg(feature = \"foo\")] configuration option. The features listed here will be passed to rustc with --cfg feature=\"${feature_name}\" flags. List of strings optional [] crate_name Crate name to use for this target.This must be a valid Rust identifier, i.e. it may contain only alphanumeric characters and underscores. Defaults to the target name, with any hyphens replaced by underscores. String optional \"\" crate_root The file that will be passed to rustc to be used for building this crate.If crate_root is not set, then this rule will look for a lib.rs file (or main.rs for rust_binary) or the single file in srcs if srcs contains only one file. Label optional None disable_pipelining Disables pipelining for this rule if it is globally enabled. This will cause this rule to not produce a .rmeta file and all the dependent crates will instead use the .rlib file. Boolean optional False edition The rust edition to use for this crate. Defaults to the edition specified in the rust_toolchain. String optional \"\" proc_macro_deps List of rust_proc_macro targets used to help build this library target. List of labels optional [] rustc_env Dictionary of additional \"key\": \"value\" environment variables to set for rustc.rust_test()/rust_binary() rules can use $(rootpath //package:target) to pass in the location of a generated file or external tool. Cargo build scripts that wish to expand locations should use cargo_build_script()'s build_script_env argument instead, as build scripts are run in a different environment - see cargo_build_script()'s documentation for more. Dictionary: String -> String optional {} rustc_env_files Files containing additional environment variables to set for rustc.These files should contain a single variable per line, of format NAME=value, and newlines may be included in a value by ending a line with a trailing back-slash (\\\\).The order that these files will be processed is unspecified, so multiple definitions of a particular variable are discouraged.Note that the variables here are subject to workspace status stamping should the stamp attribute be enabled. Stamp variables should be wrapped in brackets in order to be resolved. E.g. NAME={WORKSPACE_STATUS_VARIABLE}. List of labels optional [] rustc_flags List of compiler flags passed to rustc.These strings are subject to Make variable expansion for predefined source/output path variables like $location, $execpath, and $rootpath. This expansion is useful if you wish to pass a generated file of arguments to rustc: @$(location //package:target). List of strings optional [] stamp Whether to encode build information into the Rustc action. Possible values:- stamp = 1: Always stamp the build information into the Rustc action, even in --nostamp builds. This setting should be avoided, since it potentially kills remote caching for the target and any downstream actions that depend on it.- stamp = 0: Always replace build information by constant values. This gives good build result caching.- stamp = -1: Embedding of build information is controlled by the --[no]stamp flag.Stamped targets are not rebuilt unless their dependencies change.For example if a rust_library is stamped, and a rust_binary depends on that library, the stamped library won't be rebuilt when we change sources of the rust_binary. This is different from how cc_library.linkstamps behaves. Integer optional 0 version A version to inject in the cargo environment variable. String optional \"0.0.0\"","breadcrumbs":"Rules » rust » rust_library","id":"17","title":"rust_library"},"170":{"body":"crate.annotation(version, additive_build_file, additive_build_file_content, alias_rule, build_script_compile_data, build_script_data, build_script_tools, build_script_data_glob, build_script_deps, build_script_env, build_script_proc_macro_deps, build_script_rundir, build_script_rustc_env, build_script_toolchains, compile_data, compile_data_glob, crate_features, data, data_glob, deps, extra_aliased_targets, gen_binaries, disable_pipelining, gen_build_script, patch_args, patch_tool, patches, proc_macro_deps, rustc_env, rustc_env_files, rustc_flags, shallow_since, override_targets) A collection of extra attributes and settings for a particular crate PARAMETERS Name Description Default Value version The version or semver-conditions to match with a crate. The wildcard * matches any version, including prerelease versions. \"*\" additive_build_file A file containing extra contents to write to the bottom of generated BUILD files. None additive_build_file_content Extra contents to write to the bottom of generated BUILD files. None alias_rule Alias rule to use instead of native.alias(). Overrides render_config 's 'default_alias_rule'. None build_script_compile_data A list of labels to add to a crate's cargo_build_script::compile_data attribute. None build_script_data A list of labels to add to a crate's cargo_build_script::data attribute. None build_script_tools A list of labels to add to a crate's cargo_build_script::tools attribute. None build_script_data_glob A list of glob patterns to add to a crate's cargo_build_script::data attribute. None build_script_deps A list of labels to add to a crate's cargo_build_script::deps attribute. None build_script_env Additional environment variables to set on a crate's cargo_build_script::env attribute. None build_script_proc_macro_deps A list of labels to add to a crate's cargo_build_script::proc_macro_deps attribute. None build_script_rundir An override for the build script's rundir attribute. None build_script_rustc_env Additional environment variables to set on a crate's cargo_build_script::env attribute. None build_script_toolchains A list of labels to set on a crates's cargo_build_script::toolchains attribute. None compile_data A list of labels to add to a crate's rust_library::compile_data attribute. None compile_data_glob A list of glob patterns to add to a crate's rust_library::compile_data attribute. None crate_features A list of strings to add to a crate's rust_library::crate_features attribute. None data A list of labels to add to a crate's rust_library::data attribute. None data_glob A list of glob patterns to add to a crate's rust_library::data attribute. None deps A list of labels to add to a crate's rust_library::deps attribute. None extra_aliased_targets A list of targets to add to the generated aliases in the root crate_universe repository. None gen_binaries As a list, the subset of the crate's bins that should get rust_binary targets produced. Or True to generate all, False to generate none. None disable_pipelining If True, disables pipelining for library targets for this crate. False gen_build_script An authorative flag to determine whether or not to produce cargo_build_script targets for the current crate. None patch_args The patch_args attribute of a Bazel repository rule. See http_archive.patch_args None patch_tool The patch_tool attribute of a Bazel repository rule. See http_archive.patch_tool None patches The patches attribute of a Bazel repository rule. See http_archive.patches None proc_macro_deps A list of labels to add to a crate's rust_library::proc_macro_deps attribute. None rustc_env Additional variables to set on a crate's rust_library::rustc_env attribute. None rustc_env_files A list of labels to set on a crate's rust_library::rustc_env_files attribute. None rustc_flags A list of strings to set on a crate's rust_library::rustc_flags attribute. None shallow_since An optional timestamp used for crates originating from a git repository instead of a crate registry. This flag optimizes fetching the source code. None override_targets A dictionary of alternate targets to use when something depends on this crate to allow the parent repo to provide its own version of this dependency. Keys can be proc-marco, custom-build, lib, bin. None RETURNS string: A json encoded string containing the specified version and separately all other inputs.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate.annotation","id":"170","title":"crate.annotation"},"171":{"body":"crate.select(common, selects) A Starlark Select for crate.annotation(). PARAMETERS Name Description Default Value common A value that applies to all configurations. none selects A dict of target_triple to values. none RETURNS struct: A struct representing the Starlark Select.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate.select","id":"171","title":"crate.select"},"172":{"body":"crate.spec(package, version, artifact, lib, default_features, features, git, branch, tag, rev) A constructor for a crate dependency. See specifying dependencies in the Cargo book for more details. PARAMETERS Name Description Default Value package The explicit name of the package (used when attempting to alias a crate). None version The exact version of the crate. Cannot be used with git. None artifact Set to \"bin\" to pull in a binary crate as an artifact dependency. Requires a nightly Cargo. None lib If using artifact = \"bin\", additionally setting lib = True declares a dependency on both the package's library and binary, as opposed to just the binary. None default_features Maps to the default-features flag. True features A list of features to use for the crate [] git The Git url to use for the crate. Cannot be used with version. None branch The git branch of the remote crate. Tied with the git param. Only one of branch, tag or rev may be specified. Specifying rev is recommended for fully-reproducible builds. None tag The git tag of the remote crate. Tied with the git param. Only one of branch, tag or rev may be specified. Specifying rev is recommended for fully-reproducible builds. None rev The git revision of the remote crate. Tied with the git param. Only one of branch, tag or rev may be specified. None RETURNS string: A json encoded string of all inputs","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate.spec","id":"172","title":"crate.spec"},"173":{"body":"crate.workspace_member(version, sha256) Define information for extra workspace members PARAMETERS Name Description Default Value version The semver of the crate to download. Must be an exact version. none sha256 The sha256 checksum of the .crate file. None RETURNS string: A json encoded string of all inputs","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate.workspace_member","id":"173","title":"crate.workspace_member"},"174":{"body":"crate_deps(deps, package_name) Finds the fully qualified label of the requested crates for the package where this macro is called. PARAMETERS Name Description Default Value deps The desired list of crate targets. none package_name The package name of the set of dependencies to look up. Defaults to native.package_name(). None RETURNS list: A list of labels to generated rust targets (str)","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate_deps","id":"174","title":"crate_deps"},"175":{"body":"crate_repositories() A macro for defining repositories for all generated crates. RETURNS A list of repos visible to the module through the module extension.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate_repositories","id":"175","title":"crate_repositories"},"176":{"body":"crate_universe_dependencies(rust_version, bootstrap, kwargs) Define dependencies of the cargo-bazel Rust target PARAMETERS Name Description Default Value rust_version The version of rust to use when generating dependencies. \"1.82.0\" bootstrap If true, a cargo_bootstrap_repository target will be generated. False kwargs Arguments to pass through to cargo_bazel_bootstrap. none RETURNS list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories defined by this macro.","breadcrumbs":"External Crates » crate_universe (WORKSPACE) » crate_universe_dependencies","id":"176","title":"crate_universe_dependencies"},"177":{"body":"render_config(build_file_template, crate_label_template, crate_repository_template, crates_module_template, default_alias_rule, default_package_name, generate_target_compatible_with, platforms_template, regen_command, vendor_mode, generate_rules_license_metadata) Various settings used to configure rendered outputs The template parameters each support a select number of format keys. A description of each key can be found below where the supported keys for each template can be found in the parameter docs key definition name The name of the crate. Eg tokio repository The rendered repository name for the crate. Directly relates to crate_repository_template. triple A platform triple. Eg x86_64-unknown-linux-gnu version The crate version. Eg 1.2.3 target The library or binary target of the crate file The basename of a file PARAMETERS Name Description Default Value build_file_template The base template to use for BUILD file names. The available format keys are [{name}, {version}`]. \"//:BUILD.{name}-{version}.bazel\" crate_label_template The base template to use for crate labels. The available format keys are [{repository}, {name}, {version}, {target}]. \"@{repository}__{name}-{version}//:{target}\" crate_repository_template The base template to use for Crate label repository names. The available format keys are [{repository}, {name}, {version}]. \"{repository}__{name}-{version}\" crates_module_template The pattern to use for the defs.bzl and BUILD.bazel file names used for the crates module. The available format keys are [{file}]. \"//:{file}\" default_alias_rule Alias rule to use when generating aliases for all crates. Acceptable values are 'alias', 'dbg'/'fastbuild'/'opt' (transitions each crate's compilation_mode) or a string representing a rule in the form '