rules_rs
Next-gen Rust Bazel rules which provide a blazing-fast ergonomic `crate_universe` reimplementation, first-class Windows support, optimized toolchains, and more.
File Explorer
- metadata.template.json
- presubmit.yml
- README.md
- source.template.json
- devcontainer.json
- Dockerfile
- BUILD.bazel
- ci.bazelrc
- ci.yaml
- publish.yaml
- release.yaml
- release_prep.sh
- tag.yaml
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- additive.BUILD.bazel
- BUILD.bazel
- defs.bzl
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- additive.BUILD.bazel
- BUILD.bazel
- coreaudio.h
- defs.bzl
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- include.MODULE.bazel
- BUILD.bazel
- BUILD.bazel
- compile.bzl
- declare_toolchains.bzl
- miri_repository.bzl
- miri_test_runner.rs
- providers.bzl
- sysroot.bzl
- toolchain.bzl
- BUILD.bazel
- miri_test.bzl
- BUILD.bazel
- declare_config_settings.bzl
- BUILD.bazel
- BUILD.bazel
- declare_platforms.bzl
- triples.bzl
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- BUILD.bazel
- resolve_cross_compile_config_path.patch
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- empty.rs
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- all_crate_deps.bzl
- all_crate_deps_test.bzl
- annotations.bzl
- annotations_test.bzl
- bindgen.bzl
- bindgen_test.bzl
- bpf_linker_repository.bzl
- bpf_linker_repository_test.bzl
- BUILD.bazel
- cargo_credentials.bzl
- cargo_lints.bzl
- cargo_repository.bzl
- cargo_toml_utils.bzl
- cargo_toml_utils_test.bzl
- cargo_workspace_graph.bzl
- cargo_workspace_graph_test.bzl
- cfg_parser.bzl
- cfg_parser_test.bzl
- clippy_repository.bzl
- crate_repository.bzl
- downloader.bzl
- git_cargo_workspace_repository.bzl
- git_crate_metadata_repository.bzl
- host_tools_repository.bzl
- lint_flags.bzl
- lint_flags_test.bzl
- registry_config_repository.bzl
- registry_utils.bzl
- registry_utils_test.bzl
- repository_utils.bzl
- resolver.bzl
- rust_analyzer_repository.bzl
- rust_crate.bzl
- rust_repository_utils.bzl
- rust_repository_utils_test.bzl
- rust_src_repository.bzl
- rustc_repository.bzl
- rustc_src_repository.bzl
- rustfmt_repository.bzl
- select_utils.bzl
- semver.bzl
- semver_test.bzl
- source_stdlib.bzl
- stdlib_repository.bzl
- toml2json.bzl
- toolchains_repository.bzl
- BUILD.bazel
- declare_bindgen_toolchains.bzl
- declare_rust_analyzer_toolchains.bzl
- declare_rustc_toolchains.bzl
- declare_rustfmt_toolchains.bzl
- module_extension.bzl
- toolchain_utils.bzl
- BUILD.bazel
- cargo_build_script.bzl
- extensions.bzl
- rules_rust.bzl
- rules_rust_bindgen.bzl
- rules_rust_prost.bzl
- rules_rust_pyo3.bzl
- rules_rust_reexported_extensions.bzl
- rules_rust_wasm_bindgen.bzl
- rust_binary.bzl
- rust_library.bzl
- rust_proc_macro.bzl
- rust_shared_library.bzl
- rust_static_library.bzl
- rust_test.bzl
- rewrite_rules_rust_loads.sh
- config.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- coreaudio_sys_test.rs
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- build.rs
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- lib.rs
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- BUILD.bazel
- expect_miri_failure.rs
- miri_cfg_test.rs
- miri_dep.rs
- miri_dep_graph_test.rs
- miri_detects_use_after_free.rs
- miri_leaf.rs
- miri_proc_macro.rs
- miri_proc_macro_test.rs
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- BUILD.bazel
- BUILD.bazel
- echo.proto
- prost_smoke_test.rs
- BUILD.bazel
- pyo3_smoke.rs
- pyo3_smoke_test.py
- lib.rs
- BUILD.bazel
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.lock
- Cargo.toml
- main.rs
- Cargo.toml
- lib.rs
- udiv128.rs
- .gitignore
- Cargo.toml
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- main.rs
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- lib.rs
- udiv128.rs
- Cargo.toml
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- BUILD.bazel
- wasm_bindgen_smoke.rs
- wasm_bindgen_smoke_test.sh
- lib.rs
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- lib.rs
- Cargo.toml
- Cargo.lock
- Cargo.toml
- lib.rs
- Cargo.toml
- main.rs
- Cargo.toml
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- lib.rs
- BUILD.bazel
- Cargo.toml
- Cargo.lock
- Cargo.toml
- .bazelrc
- .bazelversion
- 3rd_party
- aws_lc_openssl.rs
- aws_lc_sys_test.rs
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- custom_registry_test.py
- datafusion-common.patch
- dummy_test.sh
- gemm-common-fp16.patch
- khronos_api.patch
- lib.rs
- libffi-aarch64-trampoline.patch
- main.rs
- MODULE.bazel
- MODULE.bazel.lock
- nasm-include.patch
- nasm-musl.patch
- objc-sys.patch
- openssl-perl-genrule.patch
- openssl-windows-udp-netreset.patch
- rav1e-nasm-0.8.1.patch
- REPO.bazel
- ring-aarch64-windows-v6.patch
- rustdoc_musl_unwind.cc
- rustdoc_musl_unwind.rs
- rustdoc_musl_unwind_test.bzl
- target_triple_constraints_test.bzl
- target_triple_constraints_test.rs
- verify_aliases.bzl
- wasmtime-internal-component-macro.patch
- windows-link.patch
- windows-version.patch
- workspace_lints_test.bzl
- BUILD.bazel
- Cargo.lock
- Cargo.toml
- cargo_metadata_stub.rs
- defs.bzl
- .bazelignore
- .bazelrc
- .bazelversion
- .gitattributes
- .gitignore
- .pre-commit-config.yaml
- .prettierignore
- .typos.toml
- BUILD.bazel
- CONTRIBUTING.md
- LICENSE
- MODULE.bazel
- MODULE.bazel.lock
- README.md
- release.sh
- renovate.json
- REPO.bazel
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Command Glossary
Commands referenced in this DOCs, explained below.
bazel
View Details ▼
bazel
Open-source build and test tool similar to Make, Maven, and Gradle.
bazel build {{target}}
Build the specified target in the workspace:
bazel clean
Remove output files and stop the server if running:
bazel shutdown
Stop the bazel server:
cargo
View Details ▼
cargo
Manage Rust projects and their module dependencies (crates).
Some subcommands such as `build` have their own usage documentation.
cargo search {{search_string}}
Search for crates:
cargo install {{crate_name}}
Install a binary crate:
cargo install --list
List installed binary crates:
rustc
View Details ▼
rustc
The Rust compiler.
Rust projects usually use `cargo` instead of invoking `rustc` directly.
rustc {{path/to/main.rs}}
Compile a binary crate:
rustc {{[-C|--codegen]}} lto {{[-C|--codegen]}} opt-level={{0|1|2|3|s|z}} {{path/to/main.rs}}
Compile with optimizations (`s` means optimize for binary size; `z` is the same with even more optimizations):
rustc {{[-g|--codegen debuginfo=2]}} {{path/to/main.rs}}
Compile with debugging information:
